当前位置:网站首页>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
边栏推荐
- require. context
- Random Shuffle attention
- Gbase 8C system table PG_ collation
- Word word word
- MUX VLAN Foundation
- COM和CN
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
- Gbase 8C create user / role example 2
- 4. Classes and objects
- Apple releases MacOS 11.6.4 update: mainly security fixes
猜你喜欢

Detailed introduction to the deployment and usage of the Nacos registry
![[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)](/img/6e/67bc187a89fb9125856c78c89f7bfb.gif)
[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)

easyExcel
![[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)](/img/e5/c01f760b07b495f5b048ea367e0c21.gif)
[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)

SPI mechanism
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane

Random Shuffle attention

xiaodi-笔记

Use go language to realize try{}catch{}finally
![[hcia]no.15 communication between VLANs](/img/59/a467c5920cbccb72040f39f719d701.jpg)
[hcia]no.15 communication between VLANs
随机推荐
Face recognition 6-face_ recognition_ Py based on OpenCV, face detection and real-time tracking using Haar cascade and Dlib Library
easyExcel
awk从入门到入土(1)awk初次会面
GBase 8c系统表-pg_class
Gbase 8C system table PG_ amproc
What does "where 1=1" mean
require.context
Detailed analysis of micro service component sentinel (hystrix)
Principle and application of database
8 free, HD, copyright free video material download websites are recommended
Cancellation of collaboration in kotlin, side effects of cancellation and overtime tasks
How to change the panet layer in yolov5 to bifpn
Hcip137-147 title + analysis
[tutorial] chrome turns off cross domain policies CORS and samesite, and brings cookies across domains
Startup mode and scope builder of collaboration in kotlin
HW-初始准备
4. 类和对象
"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b
Matlab tips (24) RBF, GRNN, PNN neural network
MATLAB小技巧(24)RBF,GRNN,PNN-神经网络