Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server

A better way to count(*)

5.00/5 (3 votes)
8 Jun 2010CPOL 7.4K  
Or, assuming your table has an index, you could do this old-school as:select MAX(rows) from sysindexes where id = Object_ID('{tablename}')
Or, assuming your table has an index, you could do this "old-school" as:

select MAX(rows) from sysindexes where id = Object_ID('{tablename}')

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)