Tuesday, December 12, 2017

SQL - Count All Rows in All Tables

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
--WHERE T.name like 'Cronus%'
ORDER  BY I.rows DESC

No comments:

Post a Comment