当前位置:网站首页>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
边栏推荐
- Principle and application of database
- Restcloud ETL cross database data aggregation operation
- Cvpr2022 remove rain and fog
- Startup mode and scope builder of collaboration in kotlin
- [translation] modern application load balancing with centralized control plane
- Javescript 0.1 + 0.2 = = 0.3 problem
- Summary of interview project technology stack
- Cancellation of collaboration in kotlin, side effects of cancellation and overtime tasks
- GBase 8c系统表-pg_attribute
- 【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
猜你喜欢

RestCloud ETL 跨库数据聚合运算

【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
![[Flutter] dart: class;abstract class;factory;类、抽象类、工厂构造函数](/img/06/ab333a4752de27eae2dd937cf579e2.png)
[Flutter] dart: class;abstract class;factory;类、抽象类、工厂构造函数

Create + register sub apps_ Define routes, global routes and sub routes

Baidu map - surrounding search

面试项目技术栈总结

8 free, HD, copyright free video material download websites are recommended

random shuffle注意
![[translation] the background project has joined the CNCF incubator](/img/0b/e3d2674b1a1cba3ea398cbcb1a018a.png)
[translation] the background project has joined the CNCF incubator

Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
随机推荐
[translation] modern application load balancing with centralized control plane
Gbase 8C system table PG_ constraint
Summary of interview project technology stack
【ROS进阶篇】第六讲 ROS中的录制与回放(rosbag)
Detailed analysis of micro service component sentinel (hystrix)
Tongda OA V12 process center
Create + register sub apps_ Define routes, global routes and sub routes
Unrecognized SSL message, plaintext connection?
2022-2028 global splicing display industry research and trend analysis report
简单理解svg
Gbase 8C trigger (I)
4. 类和对象
GBase 8c系统表-pg_aggregate
SPI机制
Restcloud ETL cross database data aggregation operation
How to change the panet layer in yolov5 to bifpn
cvpr2022去雨去雾
What does "where 1=1" mean
JS的装箱和拆箱
Gbase 8C function / stored procedure parameters (I)