|
SELECT TableName=obj.name,TotalRows=max(prt.rows),[SpaceUsed(KB)]=SUM(alloc.used_pages)*8
FROM sys.objects obj
JOIN sys.indexes idx on obj.object_id = idx.object_id
JOIN sys.partitions prt on obj.object_id = prt.object_id
JOIN sys.allocation_units alloc on alloc.container_id = prt.partition_id
WHERE obj.[type]='U'
AND idx.index_id IN (0, 1)
--AND (obj.name like 'esInfo_%' or obj.name like 'esCharge_%' or obj.name like 'esPlatform_%') -------根据表名模糊查询
GROUP BY obj.name ORDER BY TotalRows DESC
|
|