Search This Blog

Monday 27 July 2015

Select total row in each table in database or how to fetch the row count for all tables in a sql server database or sql query to display total number of rows for each table in database


SELECT A.NAME,B.ROWS
FROM DBO.SYSOBJECTS A
INNER JOIN DBO.SYSINDEXES B ON A.ID = B.ID
WHERE B.INDID < 2 AND A.NAME NOT LIKE '%SYS%' AND B.ROWS > 0
ORDER BY A.NAME


No comments:

Post a Comment