mssql2005,2008导出数据字典实现方法
来源:asp之家 时间:2023-07-23 19:11:30
在你要导出数据字典的数据空中右键,新建查询,执行如下代码即可
代码如下:
SELECT
(case when a.colorder=1 then d.name else '' end)表名,d.xtype as 表类型,
a.colorder 字段序号,
a.name 字段名,
(case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end) 标识,
(case when (SELECT count(*)
FROM sysobjects
WHERE (name in
(SELECT name
FROM sysindexes
WHERE (id = a.id) AND (indid in
(SELECT indid
FROM sysindexkeys
WHERE (id = a.id) AND (colid in
(SELECT colid
FROM syscolumns
WHERE (id = a.id) AND (name = a.name))))))) AND
(xtype = 'PK'))>0 then '√' else '' end) 主键,
b.name 类型,
a.length 占用字节数,
COLUMNPROPERTY(a.id,a.name,'PRECISION') as 长度,
isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0) as 小数位数,
(case when a.isnullable=1 then '√'else '' end) 允许空,
isnull(e.text,'') 默认值,
isnull(g.[value],'') AS 字段说明
FROM syscolumns a left join systypes b
on a.xtype=b.xusertype
inner join sysobjects d
on a.id=d.id and d.xtype in ('U','V') and d.name<>'dtproperties'
left join syscomments e
on a.cdefault=e.id
left join sys.extended_properties g
on a.id=g.major_id AND a.colid = g.major_id
order by a.id,a.colorder
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
一行命令搞定node.js 版本升级
如何用python抓取B站数据
![](https://img.aspxhome.com/file/2023/7/60737_0s.jpg)
vue实现添加标签demo示例代码
![](https://img.aspxhome.com/file/2023/9/125299_0s.png)
vue使用canvas绘制圆环
![](https://img.aspxhome.com/file/2023/6/130066_0s.jpg)
Python的加密模块md5、sha、crypt使用实例
Golang实现请求限流的几种办法(小结)
JSP读取文件实例
python中单例常用的几种实现方法总结
python中的Numpy二维数组遍历与二维数组切片后遍历效率比较
矩形相交以及求出相交的区域的原理解析
![](https://img.aspxhome.com/file/2023/2/123762_0s.jpg)
MySQL在命名用过程中所遇到的常见问题
Python绘制动态的521玫瑰花
![](https://img.aspxhome.com/file/2023/2/108162_0s.png)
产品列表到底应该怎么做?
![](https://img.aspxhome.com/file/UploadPic/20091/2/productlist01-70s.png)
PyTorch中torch.tensor()和torch.to_tensor()的区别
使用Python实现企业微信的自动打卡功能
golang 监听服务的信号,实现平滑启动,linux信号说明详解
![](https://img.aspxhome.com/file/2023/1/127041_0s.png)
python爬虫开发之使用Python爬虫库requests多线程抓取猫眼电影TOP100实例
![](https://img.aspxhome.com/file/2023/9/99519_0s.png)
Python+Selenium+PIL+Tesseract自动识别验证码进行一键登录
![](https://img.aspxhome.com/file/2023/9/110209_0s.gif)
Jupyter Notebook读取csv文件出现的问题及解决
![](https://img.aspxhome.com/file/2023/9/64649_0s.jpg)