Skip to content

Instantly share code, notes, and snippets.

@sarangbk
Created May 11, 2017 11:34
Show Gist options
  • Save sarangbk/205da90a909fbbd9b2f0239d0897650c to your computer and use it in GitHub Desktop.
Save sarangbk/205da90a909fbbd9b2f0239d0897650c to your computer and use it in GitHub Desktop.
Get row count in each user table in a Azure SQL DB
SELECT t.name as TableName, s.row_count as NumberofRows from sys.tables t
JOIN sys.dm_db_partition_stats s
ON t.object_id = s.object_id
AND t.type_desc = 'USER_TABLE'
AND t.name not like '%dss%'
AND s.index_id IN (0,1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment