取得資料庫裡的資料表、欄位、型態、長度、資料結構等資訊 (SQL Server 2008)

取得資料庫裡的資料表、欄位、型態、長度、資料結構等資訊 (SQL Server 2008)

取得資料庫裡的資料表、欄位、型態、長度、資料結構等資訊

 


 SELECT         dbo.sysobjects.name AS sTableName,
                           dbo.syscolumns.name AS sColumnsName,
                           dbo.syscolumns.prec AS iColumnsLength,
                           dbo.syscolumns.colorder AS iColumnsOrder,
                           dbo.systypes.name + '' AS sColumnsType,
                           dbo.syscolumns.isnullable AS iIsNull
 FROM             dbo.sysobjects INNER JOIN
                           dbo.syscolumns ON dbo.sysobjects.id = dbo.syscolumns.id INNER JOIN
                           dbo.systypes ON dbo.syscolumns.xusertype = dbo.systypes.xusertype
 WHERE         (dbo.sysobjects.xtype = 'U')


如有錯誤 歡迎指正