SQL中新建注释查询注释和说明
Posted 田边
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL中新建注释查询注释和说明相关的知识,希望对你有一定的参考价值。
1.查询注释
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 = ‘ND_Certificates_M‘
2. 查询说明
select value,a.name FROM syscolumns a inner join sysobjects d on a.id=d.id and d.xtype=‘U‘ and d.name<>‘dtproperties‘ left join sys.extended_properties g on a.id=G.major_id and a.colid=g.minor_id where d.name = ‘CON_Review_M‘
3.新建注释
EXECUTE sp_addextendedproperty N‘MS_Description‘, N‘证照ID‘, N‘user‘, N‘dbo‘, N‘table‘, N‘ND_Certificates_M‘, N‘column‘, N‘lendingID‘
以上是关于SQL中新建注释查询注释和说明的主要内容,如果未能解决你的问题,请参考以下文章