Created
October 24, 2017 13:12
-
-
Save tompazourek/e1ca147cfc884a9f220e2c0fe2e81cb7 to your computer and use it in GitHub Desktop.
Database tables and rows
This file contains 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 | |
CONVERT(NVARCHAR(MAX), t.[table_schema]) AS [Owner], | |
CONVERT(NVARCHAR(MAX), t.[table_name]) AS [TableName], | |
MAX(i.[rows]) AS [RecordCount] | |
FROM | |
[sysindexes] i, | |
[information_schema].[tables] t | |
WHERE | |
t.[table_name] = OBJECT_NAME(i.[id]) | |
AND t.[table_type] = 'BASE TABLE' | |
GROUP BY | |
t.[table_schema], | |
t.[table_name] | |
ORDER BY | |
t.[table_schema], | |
t.[table_name] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment