Skip to content

Instantly share code, notes, and snippets.

@vgashic
Last active March 10, 2016 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgashic/5564535 to your computer and use it in GitHub Desktop.
Save vgashic/5564535 to your computer and use it in GitHub Desktop.
All tables row count (SQL Server)
SELECT SUBSTRING(obj.name, 1, 50) AS Table_Name
,ind.rows AS Number_of_Rows
FROM sysobjects AS obj
INNER JOIN sysindexes AS ind ON obj.id = ind.id
WHERE obj.xtype = 'U'
AND ind.indid < 2
AND ind.rows > 0
ORDER BY obj.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment