SqlServer 扩展属性的介绍
时间:2024-01-17 09:32:15
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,扩展属性
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python 爬虫出现403禁止访问错误详解
2023-11-13 06:53:24
基于php(Thinkphp)+jquery 实现ajax多选反选不选删除数据功能
2024-06-07 15:29:45
Python正则表达式教程之一:基础篇
2023-11-13 19:46:02
python使用opencv对图像mask处理的方法
2021-05-03 03:23:19
![](https://img.aspxhome.com/file/2023/5/112505_0s.jpg)
基于Python实现本地音乐播放器的制作
2022-05-11 16:37:46
![](https://img.aspxhome.com/file/2023/7/80687_0s.png)
SQL Server2012数据库备份和还原的教程
2024-01-29 02:18:40
![](https://img.aspxhome.com/file/2023/5/116305_0s.jpg)
Dreamweaver2004 中文乱码解决方案
2007-01-31 10:20:00
![](https://img.aspxhome.com/file/UploadPic/20071/2007131102058101s.gif)
教你使用Python根据模板批量生成docx文档
2021-12-27 00:35:13
![](https://img.aspxhome.com/file/2023/2/76082_0s.png)
解析ajax事件的调用顺序
2023-11-21 18:12:56
带你了解MySQL中的事件调度器EVENT
2024-01-18 05:55:16
Nodejs实现短信验证码功能
2024-05-08 09:37:32
SQLServer数据库从高版本降级到低版本实例详解
2024-01-22 17:25:54
![](https://img.aspxhome.com/file/2023/3/113553_0s.jpg)
wxPython窗口的继承机制实例分析
2023-03-04 15:55:47
![](https://img.aspxhome.com/file/2023/8/69548_0s.jpg)
经典分享MySQL的limit查询优化
2011-05-05 15:47:00
Oracle 随机数
2009-06-04 10:01:00
mysql sock 文件解析及作用讲解
2024-01-26 13:15:47
Django数据库类库MySQLdb使用详解
2024-01-14 01:26:20
Golang详细讲解常用Http库及Gin框架的应用
2023-08-25 23:14:41
Python全局变量与局部变量区别及用法分析
2021-01-24 07:35:21
总结归纳python os库常用方法
2023-05-23 19:34:05