Showing posts with label row count in sql. Show all posts
Showing posts with label row count in sql. Show all posts

Fastest way to find row count of all tables in SQL

0 comments


Below is the syntax for the query which does exactly what the title suggests.


SELECT  T.NAME AS [TABLE NAME],I.ROWS AS [ROWCOUNT] 
FROM SYS.TABLES AS T INNER JOIN SYS.SYSINDEXES AS I 
ON T.OBJECT_ID = I.ID AND I.INDID < 2 
ORDER BY I.ROWS DESC