说了一堆废话,看最终的语句:
select a.COLUMN_NAME,a.DATA_TYPE,a.CHARACTER_MAXIMUM_LENGTH,b.value from information_schema.COLUMNS as a left join sys.extended_properties as b on a.TABLE_NAME=OBJECT_NAME(b.major_id) and a.ORDINAL_POSITION=b.minor_id where a.TABLE_NAME='表名'
结果:
这样只需要在代码中判断NULL字段就可以了!