Sql Server获得每个表的行数

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 ddps.[row_count];

 

posted @ 2014-04-18 16:15  Fintech技术汇  阅读(185)  评论(0编辑  收藏  举报