Home > Database > Mysql Tutorial > body text

SqlServer 扩展属性的介绍

WBOY
Release: 2016-06-07 17:54:56
Original
1092 people have browsed it

SqlServer 扩展属性的介绍,需要的朋友可以参考一下

SqlServer帮助中对扩展属性的描述是:
The Extended Properties property sets or retrieves provider-specific connection information that cannot be explicitly described through the property mechanism.
对于扩展属性有如下操作:
代码如下:
exec sp_addextendedproperty N'MS_Description', N'字段描述', N'user', N'dbo',

N'table', N'表名', N'column', N'字段名'
GO

例如:EXEC sp_addextendedproperty N'MS_Description',N'地址',N'user', dbo,N'table',
代码如下:
N'a', N'column', a_add
GO--我的表是a,要给字段a_add加上字段描述:地址

其他相关:

删除:
代码如下:
EXEC sp_dropextendedproperty N'MS_Description',N'user', dbo,N'table', N'表名',

N'column', 字段名

修改:
代码如下:
EXEC sp_updateextendedproperty N'MS_Description', N'字段描述', N'user',

dbo,N'table',N'表名', 'column', 字段

至于查询出来,sql server有提供系统函数fn_listextendedproperty ():
代码如下:
--获取某一个字段的描述
SELECT *
FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', '表名', 'column',

default)--其他变数,按照你的要求你照写即可,只要表名换成你的
where objname = '字段名'

另外也可以自己查询系统表:
代码如下:
SELECT o.name AS tableName, c.name AS columnName, p.[value] AS Description
FROM sysproperties p INNER JOIN
sysobjects o ON o.id = p.id INNER JOIN
syscolumns c ON p.id = c.id AND p.smallid = c.colid
WHERE (p.name = 'MS_Description')
ORDER BY o.name

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!