Total records

  • Hi All,

    I have xyz database which is containing 100 user table. Is there any script which I can use to get total number of records in user table seperatly.

    Urgent help would be appreciable.

    Regards,

    Austin

  • 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.

  • Todd Engen (4/8/2008)


    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.

    Or - right-click on the database, Reports, Standard Reports, Disk Usage by Table (it also includes the record counts and then some).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Keep in mind those reports are only available if Service Pack 2 is installed.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply