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)
 fast way to get number of rows of a table?

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2007-04-29 : 04:21:18
when i open the enterprise manager
stand on a table
and i nthe toolbar i go to =."view=>TaskPad"
i see on the right side all the table defenitions, and under the "table info" tab i see all the rows of of each table
-which i assume there isn't a select count(*) query made at that second), which means that number of rows are pulled from some object!
how can i do the same?
can i access the object that will give me the same result as select count(*) but faster?
thnaks in advance
peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-04-29 : 09:59:18
this will give you the count as stored in sysindexes which is not 100% up-to-the-millisecond accurate but it's good enough for a rough count, and is very cheap to query on a large table.

exec sp_spaceused MyTable




www.elsasoft.org
Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2007-04-30 : 02:19:40
thnaks alot!

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page
   

- Advertisement -