Declare @tableName varchar(50)
Set @tableName = '表名'
select syscolumns.name as 字段名, syscolumns.length as 长度, systypes.name as '数据类型', sys.extended_properties.[value] AS '字段说明',syscolumns.isnullable as '是否允许空值' from syscolumns join systypes on syscolumns.xtype=systypes.xtype and systypes.name
<> 'sysname' LEFT OUTER JOIN sys.extended_properties ON ( sys.extended_properties.minor_id = syscolumns.colid AND sys.extended_properties.major_id = syscolumns.id) where syscolumns.id in (select id from sysobjects where name= @tableName)