SQL Server 创建表并添加表注释及字段注释

create table testTable ( 
     id varchar(200) primary key not null,
     testRecord varchar(200),
)


为字段添加注释   

格式如右:execute sp_addextendedproperty \'MS_Description\',\'字段备注信息\',\'user\',\'dbo\',\'table\',\'字段所属的表名\',\'column\',\'添加注释的字段名\';  
execute sp_addextendedproperty \'MS_Description\',\'添加的注释内容\',\'user\',\'dbo\',\'table\',\'testTable\',\'column\',\'testRecord\';  
  

修改字段注释   

execute sp_updateextendedproperty \'MS_Description\',

\'修改的注释内容\',\'user\',\'dbo\',\'table\',\'testTable\',\'column\',\'testRecord\';  

删除字段注释  

execute sp_dropextendedproperty \'MS_Description\',\'user\',\'dbo\',\'table\',\'testTable\',\'column\',\'testRecord\';  
  

添加表注释  

execute sp_addextendedproperty \'MS_Description\',\'注释-些表为测试表\',\'user\',\'dbo\',\'table\',\'testTable\',null,null;  
  

修改表注释  

execute sp_updateextendedproperty \'MS_Description\',\'修改注释-测试表\',\'user\',\'dbo\',\'table\',\'testTable\',null,null;  
  

删除表注释  

execute sp_dropextendedproperty \'MS_Description\',\'user\',\'dbo\',\'table\',\'testTable\',null,null;  

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzsjyf.html