SELECT
表名=case when lorder=
表說明=case when lorder=
字段序號=lorder
字段名=a
標識=case when COLUMNPROPERTY( a
主鍵=case when exists(SELECT
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = a
))) then
類型=b
占用字節數=a
長度=COLUMNPROPERTY(a
小數位數=isnull(COLUMNPROPERTY(a
允許空=case when a
默認值=isnull(e
字段說明=isnull(g
FROM syscolumns a
left join systypes b on a
inner join sysobjects d on a
left join syscomments e on a
left join sysproperties g on a
left join sysproperties f on d
order by a
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22170.html