• The following query also gives the same results without creating a table.

    select

    TableName = object_name(id),

    [RowCount] = max(rows)

    from sysindexes

    group by id