.

Database summary Table/Rowcount

Getting a summary of your database content (database named XXXXX)  
[replace XXXXX with your database name]

Tablename vs Row count 

 

 

use XXXXX
go

use GUMCAD
go

    SET NOCOUNT ON
 
    DECLARE @SQL VARCHAR(255)
    SET @SQL = 'DBCC UPDATEUSAGE (' + DB_NAME() + ')'
    EXEC(@SQL)
 
    CREATE TABLE #foo
    (
        tablename VARCHAR(255),
        rc INT
    )
    
    INSERT #foo
        EXEC sp_msForEachTable
            'SELECT PARSENAME(''?'', 2) + ''.'' + PARSENAME(''?'', 1) ,
            COUNT(*) FROM ?'
 
    SELECT tablename, rc
        FROM #foo
        --ORDER BY rc DESC
        ORDER BY tablename asc
 
    DROP TABLE #foo

 

What's your thoughts on this?

*

Protected by WP Anti Spam