Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get *approximate* row counts of all tables in a db
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 so.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment