Skip to content

Instantly share code, notes, and snippets.

@ewoo
Last active October 8, 2015 18:11
Show Gist options
  • Save ewoo/ff4325c9cb2c6b95e139 to your computer and use it in GitHub Desktop.
Save ewoo/ff4325c9cb2c6b95e139 to your computer and use it in GitHub Desktop.
List SQL tables and their corresponding row counts.
SELECT sysobjects.Name, sysindexes.Rows
FROM sysobjects
INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE type = 'U'
AND sysindexes.IndId < 2
-- AND sysobjects.name LIKE 'SOMENAME_%'
ORDER BY sysindexes.Rows DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment