SQLSERVER 数据库查看各表的记录数

时间:2018-06-13 10:57:21   收藏:0   阅读:239

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

原文:https://www.cnblogs.com/qqhpc/p/9175804.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!