显示数据库中所有表的记录数

SELECT o.name, 
ddps.row_count 
FROM sys.indexes AS i 
INNER JOIN sys.objects AS o ON i.OBJECT_ID = o.OBJECT_ID 
INNER JOIN sys.dm_db_partition_stats AS ddps ON i.OBJECT_ID = ddps.OBJECT_ID 
AND i.index_id = ddps.index_id 
WHERE i.index_id < 2 
AND o.is_ms_shipped = 0 
ORDER BY o.NAME 

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。