当前位置:网站首页>sql server 查詢指定錶的錶結構
sql server 查詢指定錶的錶結構
2022-07-03 02:33:00 【Lee魅兒】
SELECT
錶名 = 'dbo.Treestructure',
錶說明 = CASE WHEN A.COLORDER=1 THEN ISNULL(F.VALUE,'') ELSE '' END,
字段序號 = A.COLORDER,
字段名 = A.NAME,
自增標識 = CASE WHEN COLUMNPROPERTY( A.ID,A.NAME,'ISIDENTITY')=1 THEN '√'ELSE '' END,
主鍵 = CASE WHEN EXISTS(SELECT 1 FROM SYSOBJECTS WHERE XTYPE='PK' AND PARENT_OBJ=A.ID AND NAME IN (
SELECT NAME FROM SYSINDEXES WHERE INDID IN(
SELECT INDID FROM SYSINDEXKEYS WHERE ID = A.ID AND COLID=A.COLID))) THEN '√' ELSE '' END,
數據類型 = B.NAME,
占用字節數 = A.LENGTH,
長度 = COLUMNPROPERTY(A.ID,A.NAME,'PRECISION'),
小數比特數 = ISNULL(COLUMNPROPERTY(A.ID,A.NAME,'SCALE'),0),
是否可空 = CASE WHEN A.ISNULLABLE=1 THEN '√'ELSE '' END,
默認值 = ISNULL(E.TEXT,''),
字段說明 = ISNULL(G.[VALUE],'')
FROM
SYSCOLUMNS A
LEFT JOIN SYSTYPES B ON A.XUSERTYPE=B.XUSERTYPE
INNER JOIN SYSOBJECTS D ON A.ID=D.ID AND D.XTYPE='U' 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.minor_id
LEFT JOIN sys.extended_properties F ON D.ID=F.major_id AND F.minor_id=0
where
D.name = 'Treestructure'
ORDER BY D.NAME,A.ID,A.COLORDER
边栏推荐
- 人脸识别6- face_recognition_py-基于OpenCV使用Haar级联与dlib库进行人脸检测及实时跟踪
- 错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
- COM and cn
- 【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
- GBase 8c系统表pg_cast
- SQL statement
- Create + register sub apps_ Define routes, global routes and sub routes
- Build a private cloud disk cloudrev
- easyPOI
- Coroutinecontext in kotlin
猜你喜欢
Producer consumer model based on thread pool (including blocking queue)
面试项目技术栈总结
[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)
easyPOI
SQL statement
where 1=1 是什么意思
搭建私有云盘 cloudreve
怎么将yolov5中的PANet层改为BiFPN
UDP receive queue and multiple initialization test
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
随机推荐
Cvpr2022 remove rain and fog
5. File operation
GBase 8c触发器(二)
easyExcel
返回一个树形结构数据
Gbase 8C trigger (III)
GBase 8c系统表pg_database
2022-2028 global splicing display industry research and trend analysis report
Detailed analysis of micro service component sentinel (hystrix)
Gbase 8C trigger (I)
Awk from introduction to earth (0) overview of awk
Hcip137-147 title + analysis
xiaodi-笔记
GBase 8c系统表-pg_amproc
MUX VLAN Foundation
Gbase 8C function / stored procedure parameters (I)
[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
Apple releases MacOS 11.6.4 update: mainly security fixes
Detailed introduction to the usage of Nacos configuration center
[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)