Click here to Skip to main content
15,884,425 members
Articles / Database Development / SQL Server
Alternative
Tip/Trick

A better way to count(*)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
8 Jun 2010CPOL 6.9K   5   1
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)


Written By
Web Developer
United States United States
Starting developing in 1980's using Basic, MSC 5.0, Btrieve and DBFs. Back when men were men and there were no wizards. Since then, I have developed payroll processing system, general ledger packages, billing systems, project accounting systems, order entry, a report writer, email systems, development frameworks, C++ based Web Application Server and others that have long been forgotten.

Professionally, I have been a developer, sr. developer, development lead, architect, chief architect, CTO, director of development, and consultant. I am also in charge of changing the bottled water when empty.

Comments and Discussions

 
GeneralYep, that works too. Pin
Lee Humphries8-Jun-10 15:02
professionalLee Humphries8-Jun-10 15:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.