SQL 中怎么查询一个数据库中一共有多少个表

2025-09-19 13:32:42

用户表:select count(*) 总表数 from sysobjects where xtype='u'

总表数: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 = 扩展存储过程

Posted in 2018世界杯俄罗斯
Copyright © 2088 世界杯历年冠军_世界杯央视 - zhwnj.com All Rights Reserved.
友情链接