Count Rows in SQL Database

Today i had the need to compare two databases to ensure I had all of the info.

Thanks to Kevin Kline at http://sqlserverpedia.com for this post.

SELECT
    [TableName] = so.name,
    [RowCount] = MAX(si.rows)
FROM
    sysobjects so,
    sysindexes si
WHERE
    so.xtype = 'U'
    AND
    si.id = OBJECT_ID(so.name)
GROUP BY
    so.name
ORDER BY
    1