select object_name(c.id) as 表名 ,c.name as 字段名,t.name 数据类型,c.length 长度,c.prec as 精度,p.value as 字段说明,m.text as 默认值,
case when c.status=0x80 then 1 else 0 end 标识,c.iscomputed 是否已计算该列的标志,c.isnullable 是否允许空值,c.isoutparam 是否输出参数
from syscolumns c inner join systypes t on c.xusertype=t.xusertype
left join sysproperties p on c.id=p.id and c.colid = p.smallid
left join syscomments m on c.cdefault=m.id
inner join sysobjects d
on c.id = d.id and d.xtype='U' and d.name = 'TableName'
case when c.status=0x80 then 1 else 0 end 标识,c.iscomputed 是否已计算该列的标志,c.isnullable 是否允许空值,c.isoutparam 是否输出参数
from syscolumns c inner join systypes t on c.xusertype=t.xusertype
left join sysproperties p on c.id=p.id and c.colid = p.smallid
left join syscomments m on c.cdefault=m.id
inner join sysobjects d
on c.id = d.id and d.xtype='U' and d.name = 'TableName'
本文介绍了一个SQL查询语句,用于获取指定表的所有字段及其详细信息,包括字段名称、数据类型、长度、精度、字段说明、默认值等。通过此查询可以快速了解表的结构和字段属性。

被折叠的 条评论
为什么被折叠?



