取得数据库里的数据表、字段、型态、长度、数据结构等资讯 (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‘)
如有错误 欢迎指正
原文:大专栏 取得数据库里的数据表、字段、型态、长度、数据结构等资讯 (SQL Server 2008)