• What issues you got with msforeachdb?

    One quick and dirty solution, please make your own changes

    IF object_id('tempdb..##AllDBTablesRowcnt') is not null

    Drop table ##AllDBTablesRowcnt

    Select db_name() DBName,Object_name(object_id) TableName,rows into ##AllDBTablesRowcnt from sys.partitions where index_id in (0,1)

    and 1=0

    EXEC sp_MSforeachdb '

    USE ?;

    IF db_ID()>4

    BEGIN

    Insert into ##AllDBTablesRowcnt

    Select db_name() DBName,Object_name(object_id) TableName,rows from sys.partitions where index_id in (0,1) ;

    END

    '

    Select * from ##AllDBTablesRowcnt

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]