2005151100@SQL-SERVER-表以及字段描述

Author Avatar
ClueeZhuo 5月 15, 2020
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
USE [XXX];

--添加表说明
EXEC sp_addextendedproperty N'MS_Description','表说明XXX',N'user',N'dbo',N'table',N'表名XXX',NULL,NULL
--eg
EXEC sp_addextendedproperty N'MS_Description','用户表',N'user',N'dbo',N'table',N'User',NULL,NULL

--移除表说明
EXEC sp_dropextendedproperty N'MS_Description', 'user', 'dbo', 'table', '表名XXX', NULL, NULL;
--eg:
EXEC sp_dropextendedproperty N'MS_Description', 'user', 'dbo', 'table', 'User', NULL, NULL;


--添加字段说明
EXEC sp_addextendedproperty N'MS_Description','说明XXX',N'user',N'dbo',N'table',N'表名XXX',N'column',N'字段名XXX'
--eg:
EXEC sp_addextendedproperty N'MS_Description','是否删除',N'user',N'dbo',N'table',N'User',N'column',N'IsDelete'

--删除字段说明
EXEC sp_dropextendedproperty N'MS_Description', 'user','dbo', 'table', '表名XXX', 'column','字段名XXX'
--eg:
EXEC sp_dropextendedproperty N'MS_Description', 'user','dbo', 'table', 'User', 'column','IsDelete'