SELECT tbl.name, CAST(p.rows AS int) 'count', tbl.schema_id, SCHEMA_NAME(tbl.schema_id) schema_name FROM sys.tables AS tbl INNER JOIN sys.indexes AS idx ON idx.object_id = tbl.object_id AND idx.index_id < 2 INNER JOIN sys.partitions AS p ON p.object_id = CAST(tbl.object_id AS int) AND p.index_id = idx.index_id --WHERE ((SCHEMA_NAME(tbl.schema_id) = 'dbo')) ORDER BY 2 DESC
Hope it helps.
No comments:
Post a Comment
Do provide your constructive comment. I appreciate that.