手机
当前位置:查字典教程网 >编程开发 >mssql数据库 >SqlServer 扩展属性的介绍
SqlServer 扩展属性的介绍
摘要:SqlServer帮助中对扩展属性的描述是:TheExtendedPropertiespropertysetsorretrievesprov...

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

【SqlServer 扩展属性的介绍】相关文章:

SQL Server 移动系统数据库

Sql Server中REPLACE函数的使用

SQLServer 数据库开发顶级技巧

SQL Server报错汇总

Sql Server中的视图介绍

SQLServer APPLY表运算符使用介绍

Sql Server中一次更新多列数据

SqlServer 分页存储过程

Sql Server 创建存储过程

SqlServer 2005 简单的全文检索

精品推荐
分类导航