列出MSSQL所有資料庫名 所有表名 所有欄位名

2021-08-30 16:30:13 字數 329 閱讀 3437

列出mssql所有資料庫名、所有表名、所有欄位名

1.獲取所有資料庫名

select name from master..sysdatabases order by name

2.獲取所有表名

select name from sysobjects where xtype=』u』 order by name

xtype=』u':表示所有使用者表; 

xtype=』s':表示所有系統表; 

3.獲取所有欄位名

select name from syscolumns where id=object_id(『tablename』)

獲取所有資料名 資料庫表名

1.獲取所有資料庫名 select name from master.sysdatabases order by name 2.獲取所有表名 select name from databasename.sysobjects where xtype u order by name xtype u 表示...

使用SQL查詢所有資料庫名和表名

show databases select table name from information schema.tables where table schema database name and table type base table select column name from inf...

使用SQL查詢所有資料庫名和表名

show databases select table name from information schema.tables where table schema database name andtable type base table select column name from info...