轉自: http://www.maomao365.com/?p=8919
摘要:
下文講述使用sql腳本對數據表或數據列添加注釋(備注說明)的方法分享,如下所示:
實驗環境:sql server 2008 r2
實現思路:
使用系統存儲過程sys.sp_addextendedproperty對表和列的相關屬性進行設置,達到為數據表或數據列添加注釋的目的
--數據表添加注釋的方法分享 EXEC sys.sp_addextendedproperty @name = N'MS_Description', @value = N'數據表注釋說明', @level0type = N'SCHEMA', @level0name = N'dbo', @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'數據表名稱', @level2type = N'COLUMN', @level2name = N'字段名'