数据库
首页 > 数据库> > sqlserver 统计数据库每个数据表的条数

sqlserver 统计数据库每个数据表的条数

作者:互联网

SELECT a.name 数据表,
b.rows 数据总条数
FROM sysobjects AS a
INNER JOIN sysindexes AS b ON a.id = b.id
WHERE ( a.type = 'u' )
AND ( b.indid IN ( 0, 1 ) )
ORDER BY a.name,b.rows DESC;

 

显示条数和占用大小

SELECT  OBJECT_NAME(id) 数据表,
        RTRIM(8 * dpages) + 'KB' 占用空间大小,
        rows 数据总条数
FROM    sysindexes
WHERE   indid = 1
ORDER BY rows DESC ,
        数据表 ,
        reserved DESC;

 

标签:rows,条数,indid,sqlserver,数据表,id,DESC
来源: https://www.cnblogs.com/duoe/p/15752066.html