kevin.l.williams (10/19/2010)
mtillman-921105 (10/19/2010)
It's simple tasks like this that I think MS needs to work on. Judging by this question, most of us (yours truly included) can't even get an accurate count of rows in a table. That's just nuts! MS can't simply write us a function so we don't have to sweat the small stuff like this?If I saw any production code like 2, 3 or 4, the developer would get an ear full. I will stick with count(*) thank you very much.
Maybe you're right for most everyday applications. I just tested SELECT COUNT(*) on a table with 5,900,000 rows and it was almost immediate. I think I'll stick with that too.
I think that I was being too hard on MS earlier since COUNT(*) is accurate, even if it can be slow in some circumstances.
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking