是否有任何查询返回记录多行的表的计数?
答案 0 :(得分:1)
一种方式:
select
TableName = sc.name +'.'+ ta.name, RowCnt = sum(pa.rows)
from
sys.tables ta
join sys.partitions pa on pa.object_id = ta.object_id
join sys.schemas sc on ta.schema_id = sc.schema_id
where
ta.is_ms_shipped = 0
AND pa.index_id IN (1,0)
group by sc.name,ta.name
having sum(pa.rows) > 0