Created
July 3, 2020 07:51
-
-
Save morriekken/b88e95dc974b58bc10f9e06a40e2c14b to your computer and use it in GitHub Desktop.
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
-- Replace SCHEMA and FILTER with your schema and table filter | |
-- Remove last UNION ALL from result | |
SELECT | |
CONCAT('SELECT ''', TABLE_NAME, ''' [TABLE_NAME], COUNT(*) [ROWS] FROM ', QUOTENAME(TABLE_SCHEMA), '.', QUOTENAME(TABLE_NAME),' UNION ALL') | |
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='SCHEMA' AND TABLE_NAME LIKE 'FILTER' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment