1 頁 (共 1 頁)

[MSSQL]如何找出table的column詳細資料

發表於 : 2008年 11月 28日, 17:12
tim
請使用

代碼: 選擇全部

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