代碼: 選擇全部
SELECT A.colid,
A.name as COLUMN_NAME,
C.name as DATA_TYPE,
A.length as DATA_LENGTH,
case A.isnullable when 1 then 'nullable' when 0 then 'not nullable' end as ISNULLABLE,
B.value as COLUMN_DESCRIPTION
FROM dbo.syscolumns A
left join dbo.sysproperties B on A.id = b.id and A.colid = B.smallid and B.name='MS_Description'
left join dbo.systypes C on A.xtype = C.xtype
WHERE A.id = (select id
from dbo.sysobjects
where name = '資料表名' and type = 'U')
ORDER BY A.colid