C# 获取sql数据库表列名,及列名说明备注信息

 获取指定表列名及备注:



select * from syscolumns where id=object_id(N'表名')
SELECT a.name [column], b.name type, a.prec length, isnull(c.value, ' ') [description] FROM syscolumns a LEFT OUTER JOIN systypes b ON a.xusertype = b.xusertype LEFT OUTER JOIN sys.extended_properties c ON a.id = c.major_id AND a.colid = c.minor_id WHERE a.id = object_id('表名')

 

你可能感兴趣的:(sql)