Get rowcount for each table

If you want to find row count for each table in your database without naming any table then use following script:

exec sp_MSforeachtable 'select count(*) as nr_of_rows, ''?'' as table_name from ?'

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.