码迷,mamicode.com
首页 > 数据库 > 详细

SQL中新建注释、查询注释和说明

时间:2019-01-16 16:51:39      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:dex   col   object_id   name   prope   sql   pre   cert   ext   

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 NMS_Description, N证照ID, Nuser, Ndbo, Ntable, NND_Certificates_M, Ncolumn, NlendingID

 

SQL中新建注释、查询注释和说明

标签:dex   col   object_id   name   prope   sql   pre   cert   ext   

原文地址:https://www.cnblogs.com/tianxiaotian/p/10277261.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!