Skip to content

Instantly share code, notes, and snippets.

@secretorange
Last active June 18, 2019 11:50
Show Gist options
  • Save secretorange/2ba92dac83d10bcca0ddb5b334195199 to your computer and use it in GitHub Desktop.
Save secretorange/2ba92dac83d10bcca0ddb5b334195199 to your computer and use it in GitHub Desktop.
-- TABLE ROW COUNTS
SELECT
[TableName] = so.name,
[RowCount] = MAX(si.rows)
FROM
sysobjects so,
sysindexes si
WHERE
so.xtype = 'U'
AND
si.id = OBJECT_ID(so.name)
GROUP BY
so.name
ORDER BY
2 DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment