首页 > 代码库 > sql server2008给数据表,字段,添加修改注释

sql server2008给数据表,字段,添加修改注释

1 -- 表加注释2 EXEC sys.sp_addextendedproperty @name=N‘MS_Description‘, @value=http://www.mamicode.com/N‘注释内容‘ , @level0type=N‘SCHEMA‘,@level0name=N‘dbo‘, @level1type=N‘TABLE‘,@level1name=N‘表名‘>

  

  

--新增数据字段注释EXECUTE sp_addextendedproperty ‘MS_Description‘, ‘收益浮动表‘, ‘user‘, ‘dbo‘, ‘table‘, ‘COM_IncomeFloat‘, ‘column‘, ‘RowId‘;--修改数据字段注释EXECUTE sp_updateextendedproperty ‘MS_Description‘, ‘收益浮动表‘, ‘user‘, ‘dbo‘, ‘table‘, ‘COM_IncomeFloat‘, ‘column‘, ‘RowId‘;MS_Description :调用的ProcCOM_IncomeFloat :表名RowId :表字段查询字段注释SELECTA.name AS table_name,B.name AS column_name,C.value AS column_descriptionFROM sys.tables AINNER JOIN sys.columns B ON B.object_id = A.object_idLEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_idWHERE A.name = ‘COM_IncomeFloat‘

  

sql server2008给数据表,字段,添加修改注释