Ms sqlserver 查询表注释和字段注释
一 Sqlserver查询所有表名及其描述
select top 1000 ROW_NUMBER() OVER (ORDER BY a.name) AS No, a.name AS 表名, CONVERT(NVARCHAR(100),isnull(g.[value],'-')) AS 说明 from sys.tables a left join sys.extended_properties g on (a.object_id = g.major_id AND g.minor_id = 0)
二 查询表的字段和字段注释
SELECT A.name AS table_name, B.name AS column_name, C.value AS column_description FROM sys.tables A INNER JOIN sys.columns B ON B.object_id = A.object_id LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id WHERE A.name = '表名'
三、获取表字段和字段类型
select column_name name,data_type type from information_schema.columns where table_name = '表名'
平淡中储蓄成长
相关文章
发表评论
评论列表
- 这篇文章还没有收到评论,赶紧来抢沙发吧~