• Here's one simple way to do that. Just copy-and-paste the results into another query window.

    USE MyDatabase

    SELECT 'SELECT COUNT(*), ''' + name + ''' FROM ' + name FROM sys.tables

    Or you could look at using the stored procedure sp_MSforeachtable.