SQL Server中查询某个数据库中表的个数

时间:2024-06-03 16:34:14
--SQL Server中 数表:
SELECT * FROM SYSOBJECTS WHERE xtype = 'U';
SELECT COUNT(*) FROM SYSOBJECTS WHERE xtype = 'U';

--数视图:

SELECT * FROM SYSOBJECTS WHERE xtype = 'V';
SELECT COUNT(*) FROM SYSOBJECTS WHERE xtype = 'V';

--数存储过程

SELECT * FROM SYSOBJECTS WHERE xtype = 'V';
SELECT COUNT(*) FROM SYSOBJECTS WHERE xtype = 'V';

C = CHECK 约束 
D = 默认值或 DEFAULT 约束 
F = FOREIGN KEY 约束 
L = 日志 
FN = 标量函数 
IF = 内嵌表函数 
P = 存储过程 
PK = PRIMARY KEY 约束(类型是 K) 
RF = 复制筛选存储过程 
S = 系统表 
TF = 表函数 
TR = 触发器 
U = 用户表 
UQ = UNIQUE 约束(类型是 K) 
V = 视图 
X = 扩展存储过程