DECLARE@TableName sysname ='Company';--表名SELECT
column_id AS dolumnId,
ISNULL(t.desctr,'')AS desr,
col.name AS colname,
typ.name,
col.is_nullable AS nullableSign
FROM sys.columns col
LEFTJOIN(SELECT
ISNULL(CAST(properties.valueASVARCHAR),'')AS desctr ,
properties.minor_id AS minor_id
FROM sys.extended_properties properties
WHERE properties.major_id = OBJECT_ID(@TableName)) t ON t.minor_id = col.column_id
JOIN sys.types typ ON col.system_type_id = typ.system_type_id
AND col.user_type_id = typ.user_type_id
WHERE object_id = OBJECT_ID(@TableName)