Home Forums Programming General Looking for single system query to return the rowcount of all tables in a DB RE: Looking for single system query to return the rowcount of all tables in a DB

  • or you can try this.

     

    sp_msforeachtable @command1 = 'print ''?''' ,

     @command2 = 'select count (*) from ?'

     

    sp_msforeachtable will perform up to three commands on each table in the database. When running, it replaces the ? with the name of the table.