查詢資料庫中有多少個資料表

2021-06-13 07:54:36 字數 687 閱讀 6272

剛才那個是使用者表,下面這個是系統表加使用者表:

select count(*) 總表數 from sysobject s where xtype in('u','s')

總檢視數:select count(*) 總檢視數 from sysobjects where xtype='v'

總儲存過程數:select count(*) 總儲存過程數 from sysobjects where xtype='p'

總觸發器數:select count(*) 總觸發器數 from sysobjects where xtype='tr'

資料庫作業: select count(*) from msdb.dbo.sysjobs 

sysobjects 表引數說明----

d = 預設值或 default 約束

f = foreign key 約束

l = 日誌

fn = 標量函式

if = 內嵌表函式

p = 儲存過程

pk = primary key 約束(型別是 k)

rf = 複製篩選儲存過程

s = 系統表

tf = 表函式

tr = 觸發器

u = 使用者表

uq = unique 約束(型別是 k)

v = 檢視

x = 擴充套件儲存過程

**

sql server 查詢資料庫中有多少個表

select from sysobjects where xtype u select from sysobjects where xtype u select from sysobjects where xtype c select from sysobjects where xtype d se...

sql server 查詢資料庫中有多少個表

select from sysobjects where xtype u select from sysobjects where xtype u select from sysobjects where xtype c select from sysobjects where xtype d se...

查詢資料庫中有多少張表

sql server 2005 select from sysobjects where xtype u 查詢當前資料庫 下所有使用者建立的表 xtype char 2 物件型別。可以是下列物件型別中的一種 c check 約束 d 預設值或 default 約束 f foreign key 約束 ...