Sql获取数据表字段说明
SELECT Sysobjects.name AS TABLE_NAME , syscolumns.Id , syscolumns.name AS COLUMN_NAME , systypes.name AS DATA_TYPE , syscolumns.length AS CHARACTER_MAXIMUM_LENGTH , sys.extended_properties.[value] AS COLUMN_DESCRIPTION , syscomments.text AS COLUMN_DEFAULT , syscolumns.isnullable AS IS_NULLABLE FROM syscolumns INNER JOIN systypes ON syscolumns.xtype = systypes.xtype LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id LEFT OUTER JOIN sys.extended_properties ON ( sys.extended_properties.minor_id = syscolumns.colid AND sys.extended_properties.major_id = syscolumns.id ) LEFT OUTER JOIN syscomments ON syscolumns.cdefault = syscomments.id WHERE syscolumns.id IN ( SELECT id FROM SYSOBJECTS WHERE xtype = 'U' ) AND ( systypes.name <> 'sysname' ) AND Sysobjects.name='OriginalData' -- 表名称 ORDER BY syscolumns.colid
见图:
中山赢友网络科技有限公司(http://www.winu.net/)承接IOS、Android、Window Phone 8+、Window 10 App应用开发,IOS、Android、Window Phone 8+游戏开发,.NET/PHP软件系统开发,HTML5网站、游戏、微官网开发。欢迎致电:0760-88809987、18676265646 陈先生。