Skip to content

Instantly share code, notes, and snippets.

@FembotDBA
Last active December 19, 2015 13:29
Show Gist options
  • Save FembotDBA/5962630 to your computer and use it in GitHub Desktop.
Save FembotDBA/5962630 to your computer and use it in GitHub Desktop.
T-SQL Row Count of all user tables in database
SELECT o.name AS "Table Name", i.rowcnt AS "Row Count"
FROM sysobjects o, sysindexes i
WHERE i.id = o.id
AND indid IN(0,1)
AND xtype = 'u'
AND o.name <> 'sysdiagrams'
ORDER BY i.rowcnt DESC
COMPUTE SUM(i.rowcnt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment