Fastest way to find the number of records in MS SQL

Have you ever had a table to a lot of rows, when I mean a lot I mean over 1,000,000 records.

If you try and perform a row count like

SELECT COUNT(ID) FROM table

it just takes forever.

If you are running SQL server you can perform a look up in the sysindexes table

SELECT rows
FROM sysindexes
WHERE id = OBJECT_ID(‘table‘)
AND indid < 2

much fast, but not so easy.