Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 no of records

Author  Topic 

ajay
Starting Member

34 Posts

Posted - 2003-05-09 : 15:13:18
Using Query Analyzer, Please tell me 3 ways to get an accurate count of the number of records in a table..
One offcourse select count(*)...
Other two..?
Thanks

ajay

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-09 : 15:27:59
Is your examine today?

Brett

8-)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-05-09 : 15:37:48
I was wondering the same thing.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-09 : 16:25:23
Maybe you can count them by hand?


Brett

8-)
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-05-09 : 17:26:06
SELECT SUM(1) ...
(It's two characters shorter, too)


Edited by - Arnold Fribble on 05/09/2003 17:26:42
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-05-09 : 17:36:00
In query analyzer?

OK ... how about

SELECT 1 from ...


then just look at the row count returned at the end of the results.

(That's even shorter to type ! not very efficent I'm afraid ...)

but i fear we are definitely just answering a homework question here ....

good luck in your class.

- Jeff
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-05-09 : 18:11:55
and for the third
SELECT SUM(2-1) ...


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-09 : 23:36:27
We're not trying to be mean ( are we?)


But do some leg work


sp_spaceused??


HELLO



Brett

8-)
Go to Top of Page
   

- Advertisement -