SELECT b.name 列名, c.name 数据类型,b.max_length 长度,
CASE b.is_nullable
WHEN 0 THEN '否'
WHEN 1 THEN '是'
end
是否为空
,d.value AS 备注 FROM sys.tables a
INNER JOIN sys.columns b ON a.object_id=b.object_id
LEFT JOIN sys.types c ON b.system_type_id=c.system_type_id
LEFT JOIN sys.extended_properties d ON a.object_id=d.major_id AND b.column_id=d.minor_id
WHERE a.name='表名称'
ORDER BY b.column_id