Heim  >  Artikel  >  php教程  >  MSSQL添加字段说明

MSSQL添加字段说明

WBOY
WBOYOriginal
2016-06-06 20:01:301367Durchsuche

--字段添加说明 EXEC sp_addextendedproperty 'MS_Description', '要添加的说明', 'user', dbo, 'table', 表名, 'column', 列名 --删除字段说明 EXEC sp_dropextendedproperty 'MS_Description', 'user', dbo, 'table', 表名, 'column', 字段名 --查看字段说

--字段添加说明
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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:C# 生成各种格式各种大小的图片类Nächster Artikel:c#用户控件