首页 > 代码库 > Sql Server 添加、更新、查询表注释、字段注释相关sql

Sql Server 添加、更新、查询表注释、字段注释相关sql


/*******************字段添加注释*********************/ if not exists (SELECT C.value AS column_description FROM sys.tables A INNER JOIN sys.columns B ON B.object_id = A.object_id INNER JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id WHERE A.name = N‘表名‘ and B.name=N‘字段名‘) 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‘表名‘, @level2type=N‘COLUMN‘,@level2name=N‘字段名‘>

  

Sql Server 添加、更新、查询表注释、字段注释相关sql