sqlserver表結構查詢
SELECT CASE WHEN a.colorder = 1 THEN d.name ELSE '' END AS 表名,
CASE WHEN a.colorder = 1 THEN isnull(f.value, '') ELSE '' END AS 表說明,
a.colorder AS 欄位序號, a.name AS 欄位名, CASE WHEN COLUMNPROPERTY(a.id,
a.name, 'IsIdentity') = 1 THEN '√' ELSE '' END AS 標識,
CASE WHEN EXISTS
(SELECT 1
FROM sysobjects
WHERE xtype = 'PK' 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 AS 主鍵, b.name AS 型別, a.length AS 佔用位元組數,
COLUMNPROPERTY(a.id, a.name, 'PRECISION') AS 長度,
ISNULL(COLUMNPROPERTY(a.id, a.name, 'Scale'), 0) AS 小數位數,
CASE WHEN a.isnullable = 1 THEN '√' ELSE '' END AS 允許空, ISNULL(e.text, '')
AS 預設值, ISNULL(g.[value], '') AS 欄位說明
FROM syscolumns a LEFT OUTER JOIN
systypes b ON a.xtype = b.xusertype INNER JOIN
sysobjects d ON a.id = d.id AND d.xtype = 'U' AND
d.name <> 'dtproperties' LEFT OUTER JOIN
syscomments e ON a.cdefault = e.id LEFT OUTER JOIN
sysproperties g ON a.id = g.id AND a.colid = g.smallid LEFT OUTER JOIN
sysproperties f ON d.id = f.id AND f.smallid = 0
ORDER BY a.id, a.colorder
相關文章
- 【PHP資料結構】雜湊表查詢PHP資料結構
- SqlServer遞迴查詢SQLServer遞迴
- 查詢SQLSERVER版本號SQLServer
- 查詢最佳化——查詢樹結構
- sqlserver查詢結果中新增自動編號SQLServer
- SQLSERVER查詢某個資料庫有幾張表SQLServer資料庫
- 樹形結構的選單表設計與查詢
- Sqlserver資料庫郵件的體系結構及常用的查詢檢視SQLServer資料庫
- SQLServer通過連結伺服器查詢表報錯 “訊息 7313,級別 16”SQLServer伺服器
- 【記錄】sqlserver列轉行查詢 並將查詢結果用逗號分隔開SQLServer
- SQLSERVER跨伺服器查詢SQLServer伺服器
- SQLServer DML操作阻塞SELECT查詢SQLServer
- (2) SqlServer表與索引的結構的補充SQLServer索引
- ORACLE結構化查詢語句Oracle
- NKMySQL 查詢樹結構方式gllMySql
- 23.資料結構 查詢資料結構
- ORACLE遞迴查詢(適用於ID,PARENTID結構資料表)Oracle遞迴
- SQLServer查詢所有資料庫大小SQLServer資料庫
- sqlserver查詢長括號[資料SQLServer
- SQL單表查詢語句總結SQL
- 資料結構實驗之查詢七:線性之雜湊表資料結構
- 重學資料結構(八、查詢)資料結構
- 【資料結構】查詢結構(二叉排序樹、ALV樹、雜湊技術雜湊表)資料結構排序
- SQLServer查詢哪些索引利用率低SQLServer索引
- Hibernate5.1+Sqlserver2000分頁查詢SQLServer
- PostgreSQL函式:返回表查詢結果集SQL函式
- 單表查詢
- SQL語言(結構化查詢語言)SQL
- Java實現遞迴查詢樹結構Java遞迴
- Elasticsearch 結構化搜尋、keyword、Term查詢Elasticsearch
- Java資料結構(十五)—— 多路查詢樹Java資料結構
- Sqlserver查詢alwayson同步情況指令碼(2)SQLServer指令碼
- SQLServer查詢使用者儲存過程SQLServer儲存過程
- BST查詢結構與折半查詢方法的實現與實驗比較
- SQL(Structured Query Language,結構化查詢語言)SQLStruct
- 查詢 - 符號表符號
- MySQL 單表查詢MySql
- MySQL單表查詢MySql
- JPA 連表查詢