SQL生成数据字典语句
时 间:2019-08-02 08:31:16
作 者:缪炜 ID:24010 城市:江阴
摘 要:SQL生成数据字典语句
正 文:
Select [表名] = c.name, [表说明] = Isnull(f.[value],''), [列名] = a.name, [列序号] = a.column_id, [标识] = CASE WHEN is_identity = 1 THEN '√' ELSE '' END, [主键] = CASE WHEN EXISTS (Select 1 FROM sys.objects x JOIN sys.indexes y ON x.TYPE = N'PK' AND x.name = y.name JOIN sysindexkeys z ON z.id = a.object_id AND z.indid = y.index_id AND z.colid = a.column_id) THEN '√' ELSE '' END, [类型] = b.name, [字节数] = CASE WHEN a.[max_length] = -1 AND b.name != 'xml' THEN 'max/2G' WHEN b.name = 'xml' THEN '2^31-1字节/2G' ELSE Rtrim(a.[max_length]) END, [长度] = CASE WHEN Columnproperty(a.object_id,a.name,'Precision') = -1 THEN '2^31-1' ELSE Rtrim(Columnproperty(a.object_id,a.name,'Precision')) END, [小数] = Isnull(Columnproperty(a.object_id,a.name,'Scale'), 0), [是否为空] = CASE WHEN a.is_nullable = 1 THEN '√' ELSE '' END, [列说明] = Isnull(e.[value],''), [默认值] = Isnull(d.text,'') FROM sys.columns a LEFT JOIN sys.types b ON a.user_type_id = b.user_type_id INNER JOIN sys.objects c ON a.object_id = c.object_id AND c.TYPE = 'U' LEFT JOIN syscomments d ON a.default_object_id = d.id LEFT JOIN sys.extended_properties e ON e.major_id = c.object_id AND e.minor_id = a.column_id AND e.class = 1 LEFT JOIN sys.extended_properties f ON f.major_id = c.object_id AND f.minor_id = 0 AND f.class = 1 orDER BY c.name
Access软件网QQ交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- Access判断多条明细的配方或订...(11.30)
- 如何让后台数据库在局域网共享时,且...(11.29)
- 【Access月初月末日期设置方法...(11.29)
- 【Access IIF函数嵌套示例...(11.26)
- Access快速开发平台--使用组...(11.25)
- Access快速开发平台--对上传...(11.22)
- Access快速开发平台企业版--...(11.18)
- 不会用多表联合查询,多表查询没结果...(11.16)
- 【案例分享】主键字段值含有不间断空...(11.16)
- Access快速开发平台--后台D...(11.14)