当前位置:网站首页>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
边栏推荐
- Gbase 8C function / stored procedure definition
- Principle and application of database
- Simple understanding of SVG
- Pytorch convolution network regularization dropblock
- Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
- COM和CN
- Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
- [Hcia]No.15 Vlan间通信
- Return a tree structure data
- GBase 8c系统表-pg_attribute
猜你喜欢

Detailed introduction to the usage of Nacos configuration center

Random shuffle note

Tongda OA homepage portal workbench

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

线程安全的单例模式
![[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)](/img/65/c1fe95f8c391394f7ff1b75c7d75b6.jpg)
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)

Matlab tips (24) RBF, GRNN, PNN neural network

xiaodi-笔记
![[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)](/img/6a/ae44ddb090ce6373f04a550a15f973.jpg)
[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)
随机推荐
Gbase 8C trigger (III)
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
内存池(内核角度理解new开辟空间的过程)
Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution
GBase 8c系统表-pg_authid
通达OA 首页门户工作台
Why choose a frame? What frame to choose
Summary of interview project technology stack
通达OA v12流程中心
Qt之QComboBox添加QCheckBox(下拉列表框插入复选框,含源码+注释)
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
Gbase 8C system table PG_ amop
Interview stereotyped version
RestCloud ETL 跨库数据聚合运算
GBase 8c 函数/存储过程参数(一)
easyPOI
Build a private cloud disk cloudrev
random shuffle注意
HTB-Devel
SPI机制