Skip to content

Instantly share code, notes, and snippets.

@digioz
Created September 30, 2016 23:52
Show Gist options
  • Save digioz/78ae871d979ca6e58a7a1a29527f872d to your computer and use it in GitHub Desktop.
Save digioz/78ae871d979ca6e58a7a1a29527f872d to your computer and use it in GitHub Desktop.
Get a row count in all table microsoft sql database
sp_MSForEachTable 'DECLARE @t AS VARCHAR(MAX);
SELECT @t = CAST(COUNT(1) as VARCHAR(MAX))
+ CHAR(9) + CHAR(9) + ''?'' FROM ? ; PRINT @t'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment