SQLSERVER 數據庫查看各表的記錄數
阿新 • • 發佈:2018-06-13
object pan gray esc sin In row ray color
1.各表記錄數
select a.name as 表名,max(b.rows) as 記錄條數 from sysobjects a ,sysindexes b
where a.id=b.id and a.xtype=‘u‘
group by a.name
order by max(b.rows) desc
2.總記錄數
select SUM(記錄條數) as 總記錄數 from(
select
top 10000 a.name
as
表名,max(b.rows) as
記錄條數
from
sysobjects
a ,sysindexes
b
where a.id=b.id and a.xtype=‘u‘
group by a.name
order by max(b.rows) desc
) t1
SQLSERVER 數據庫查看各表的記錄數