MSSQL 添加字段说明
时间:2021-10-29 08:31:54|栏目:Mysql|点击: 次
--字段添加说明
EXEC sp_addextendedproperty 'MS_Description', '要添加的说明', 'user', dbo, 'table', 表名, 'column', 列名
--删除字段说明
EXEC sp_dropextendedproperty 'MS_Description', 'user', dbo, 'table', 表名, 'column', 字段名
--查看字段说明
SELECT
[Table Name] = i_s.TABLE_NAME,
[Column Name] = i_s.COLUMN_NAME,
[Description] = s.value
FROM
INFORMATION_SCHEMA.COLUMNS i_s
LEFT OUTER JOIN
sysproperties s
ON
s.id = OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME)
AND s.smallid = i_s.ORDINAL_POSITION
AND s.name = 'MS_Description'
WHERE
OBJECTPROPERTY(OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME), 'IsMsShipped')=0
AND i_s.TABLE_NAME = 'jobs'
ORDER BY
i_s.TABLE_NAME, i_s.ORDINAL_POSITION
EXEC sp_addextendedproperty 'MS_Description', '要添加的说明', 'user', dbo, 'table', 表名, 'column', 列名
--删除字段说明
EXEC sp_dropextendedproperty 'MS_Description', 'user', dbo, 'table', 表名, 'column', 字段名
--查看字段说明
复制代码 代码如下:
SELECT
[Table Name] = i_s.TABLE_NAME,
[Column Name] = i_s.COLUMN_NAME,
[Description] = s.value
FROM
INFORMATION_SCHEMA.COLUMNS i_s
LEFT OUTER JOIN
sysproperties s
ON
s.id = OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME)
AND s.smallid = i_s.ORDINAL_POSITION
AND s.name = 'MS_Description'
WHERE
OBJECTPROPERTY(OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME), 'IsMsShipped')=0
AND i_s.TABLE_NAME = 'jobs'
ORDER BY
i_s.TABLE_NAME, i_s.ORDINAL_POSITION
上一篇:mysql 5.7.11 zip安装配置方法图文教程
栏 目:Mysql
下一篇:win2008下mysql8.0.11升级mysql8.0.17版本详细步骤
本文标题:MSSQL 添加字段说明
本文地址:http://www.codeinn.net/misctech/181639.html