查詢資料庫裡所有表名和欄位名

2021-07-11 01:01:37 字數 2033 閱讀 8887

在測試時,想要過濾查詢某個資料庫內的表名 只包含 '_autest' 字元,在網上查了下 如何查詢整個資料庫表的 sql語句 如下:

查詢資料庫裡所有表名和欄位名的語句

sql 查詢所有表名:

select name from sysobjects where type='u' and name like '%_autest%'

select * from information_schema.tables where table_name like '%_autest%'

查詢表的所有欄位名:

select name from syscolumns where id=object_id(' 表名' )

select * from information_schema.tables

select * from information_schema.views

select * from information_schema.columns

oracle 檢視所有表名:

select table_name from user_tables

access 檢視所有表名:

select name from msysobjects where type=1 and flags=0

msysobjects 是系統物件,預設情況是隱藏的。通過工具、選項、檢視、顯示、系統物件可以使之顯示出來。

字段型別

中文說明

限制條件

其它說明

char

固定長度字串

最大長度2000 bytes

varchar2

可變長度的字串

最大長度4000 bytes

可做索引的最大長度749

nchar

根據字符集而定的固定長度字串

最大長度2000 bytes

nvarchar2

根據字符集而定的可變長度字串

最大長度4000 bytes

date

日期(日- 月- 年)

dd-mm-yy (hh-mi-ss )

經過嚴格測試,無千蟲問題

long

超長字串

最大長度 2g (231 -1 )

足夠儲存大部頭著作

raw

固定長度的二進位制資料

最大長度2000 bytes

可存放多**圖象聲音等

long raw

可變長度的二進位制資料

最大長度 2g

同上 blob

二進位制資料

最大長度 4g

clob

字元資料

最大長度 4g

nclob

根據字符集而定的字元資料

最大長度 4g

bfile

存放在資料庫外的二進位制資料

最大長度 4g

rowid

資料表中記錄的唯一行號

10 bytes ********.****.**** 格式,* 為0 或1

nrowid

二進位制資料表中記錄的唯一行號

最大長度4000 bytes

number(p,s)

數字型別

p 為整數字,s 為小數字

decimal(p,s)

數字型別

p 為整數字,s 為小數字

integer

整數型別

小的整數

float

浮點數型別

number(38) ,雙精度

real

實數型別

number(63) ,精度更高

查詢資料庫中所有表名,查詢表中所有欄位名

mysql 1.查詢資料庫中所有表名稱 select table name from information schema.tables where table schema 資料庫名稱 包含檢視 select table name from information schema.tables wh...

MSSQL列出庫裡面的所有表名和欄位名

use 資料庫 select a.name as 表名,b.name as 欄位名,b.length as 字段長度,c.name 字段型別 from select from sysobjects where xtype u a join syscolumns b on a.id b.id left...

獲取資料庫所有表名與欄位名

1.獲取所有資料庫名 select name from master.sysdatabases 2.獲取所有表名 select name from sysobjects where type u xtype u 表示所有使用者表 xtype s 表示所有系統表 3.獲取所有欄位名 select na...