Last active
August 25, 2021 08:32
-
-
Save GregTrevellick/cf3937fddceb134375d3ff3f53b4cf33 to your computer and use it in GitHub Desktop.
TSQL get table names and table row counts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SCHEMA_NAME(A.schema_id) + '.' + A.Name, AVG(B.rows) AS 'RowCount' | |
FROM sys.objects A | |
INNER JOIN sys.partitions B ON A.object_id = B.object_id | |
WHERE A.type = 'U' | |
GROUP BY A.schema_id, A.Name | |
--ORDER BY AVG(B.rows) DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment