Active Server - A Less Taxing Alternative To Count(*)
For SQL server users, there's an even more resource-friendly way to obtain a table record count than the standard SQL count(*) statement. You can get the value from the sysindexes table where SQL server automatically stores the most up-to-date count. The syntax for the SQL query to accomplish this task is as follows:
- SELECT rows FROM sysindexes WHERE id=OBJECT_ID ('your_table')
This method is a slightly faster way to obtain a record count, especially if your database tables are very large. However, you won't be able to use the Where clause to obtain more specialized record counts, such as SELECT count(*) FROM mytable WHERE hrs > 40.