• There are better ways if all you need is the total record count of a table. Instead of returning all the data you could return just the number of rows (SELECT count(1) FROM table). This will prevent a lot of data being read and displayed on the screen.

    Another way is to use the DMV's about the indexes. Read the rowcount from the HEAP (index_id = 0) or from the clustered index (index_id = 1). As far as I know this is the fastest way.

    SELECT

    object_name(object_id) as table_name

    , row_count

    FROM

    sys.dm_db_partition_stats st

    WHERE

    index_id < 2

    AND object_id = object_id('tablename')

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **