查询某个库的所有表的行数,需要先选择需要查询的对应数据库名称,然后执行SQL语句
select b.name as tablename ,
c.row_count as datacount
from sys.indexes a ,
sys.objects b ,
sys.dm_db_partition_stats c
where a.[object_id] = b.[object_id]
AND b.[object_id] = c.[object_id]
AND a.index_id = c.index_id
AND a.index_id < 2
AND b.is_ms_shipped = 0