|
本帖最后由 幻雪丶逆时光 于 2012-12-18 13:40 编辑
]{:soso_e113:}貌似这里 没什么东西啊 那我抛砖引玉下吧
[code=sql]SELECT ( CASE WHEN a.colorder = 1 THEN d.name
ELSE ''
END ) N'TAB_NAME' ,
a.colorder N'COL_Nun' ,
a.name N'COL_NAME' ,
( CASE WHEN COLUMNPROPERTY(a.id, a.name, 'IsIdentity') = 1 THEN '√'
ELSE ''
END ) N'COL_Iden' ,
( CASE WHEN ( SELECT COUNT(*)
FROM sysobjects
WHERE ( name IN (
SELECT name
FROM sysindexes
WHERE ( id = a.id )
AND ( indid IN (
SELECT indid
FROM sysindexkeys
WHERE ( id = a.id )
AND ( colid IN (
SELECT
colid
FROM
syscolumns
WHERE
( id = a.id )
AND ( name = a.name ) ) ) ) ) ) )
AND ( xtype = 'PK' )
) > 0 THEN '√'
ELSE ''
END ) N'COL_key' ,
b.name N'COL_TYPE' ,
a.length N'COL_byte' ,
COLUMNPROPERTY(a.id, a.name, 'PRECISION') AS N'COL_length' ,
ISNULL(COLUMNPROPERTY(a.id, a.name, 'Scale'), 0) AS N'COL_digital' ,
( CASE WHEN a.isnullable = 1 THEN '√'
ELSE ''
END ) N'ISNULL' ,
ISNULL(e.text, '') N'default' ,
ISNULL(g.[value], '') AS N'字段说明'
FROM syscolumns a
LEFT JOIN systypes b ON a.xtype = b.xusertype
INNER JOIN sysobjects d ON a.id = d.id
AND d.xtype = 'U'
AND d.name <> 'dtproperties'
LEFT JOIN syscomments e ON a.cdefault = e.id
LEFT JOIN sys.extended_properties g ON a.id = g.major_id
AND a.colid = g.minor_id
WHERE d.name = 'fwjk_househealth' ----表名
--AND a.NAME = 'cmbhouse_township'
ORDER BY OBJECT_NAME(a.id) ,
a.colorder[/code]
效果
|
-
|