数据库
首页 > 数据库> > sql server 为表格添加注释语句

sql server 为表格添加注释语句

作者:互联网

1、为表格添加注释

EXEC sys.sp_addextendedproperty @name=N'MS_Description', 
@value=N'表格注释内容' , 
@level0type=N'SCHEMA',@level0name=N'选择dbo或者guest', 
@level1type=N'TABLE',@level1name=N'表格名称'

// 例如:
EXEC sys.sp_addextendedproperty @name=N'MS_Description', 
@value=N'测试表格' , 
@level0type=N'SCHEMA',@level0name=N'dbo', 
@level1type=N'TABLE',@level1name=N'test_table'

  

2、为表格中的字段添加注释

EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N'字段注释内容' , 
@level0type=N'SCHEMA',@level0name=N'选择dbo或者guest',
@level1type=N'TABLE',@level1name=N'字段所属表格名称',
@level2type=N'COLUMN',@level2name=N'字段名称';

// 例如:
EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N'自增ID' , 
@level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'test_table',
@level2type=N'COLUMN',@level2name=N'tt_id';

  

标签:语句,level1type,dbo,server,表格,sql,addextendedproperty,TABLE,SCHEMA
来源: https://www.cnblogs.com/lucky-jun/p/16267728.html