1. 程式人生 > >Sql Server 給表及字段添加註釋

Sql Server 給表及字段添加註釋

base dex es2017 pex 添加 @value logs table images

一、table

1、添加表註釋

EXECUTE sys.sp_addextendedproperty @name = NMS_Description, -- sysname
    @value = N字典組表, -- sql_variant
    @level0type = Nuser, -- varchar(128)
    @level0name = Nbase, -- sysname schema
    @level1type =  Ntable, -- varchar(128)
    @level1name = NtblDictionaryGroup
, -- sysname @level2type = NULL, -- varchar(128) @level2name = NULL -- sysname

技術分享

2、修改表註釋

EXECUTE sys.sp_updateextendedproperty @name = NMS_Description, -- sysname
    @value = N字典組表1, -- sql_variant
    @level0type = Nuser, -- varchar(128)
    @level0name = Nbase, -- sysname schema
    @level1type
= Ntable, -- varchar(128) @level1name = NtblDictionaryGroup, -- sysname @level2type = NULL, -- varchar(128) @level2name = NULL -- sysname

技術分享

3、刪除表註釋

 EXECUTE sys.sp_dropextendedproperty @name = NMS_Description, -- sysname 
    @level0type = Nuser, -- varchar(128)
    @level0name
= Nbase, -- sysname schema @level1type = Ntable, -- varchar(128) @level1name = NtblDictionaryGroup, -- sysname @level2type = NULL, -- varchar(128) @level2name = NULL -- sysname

技術分享

二、Column

1、添加字段註釋

Sql Server 給表及字段添加註釋