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 2005 Forums
 Express Edition and Compact Edition (2005)
 Count records

Author  Topic 

nheijmink
Starting Member

8 Posts

Posted - 2008-01-20 : 08:44:31
Hi
i am just an beginner with sql and i am quite sure this will be a simple question
i am looking for a methode to count the number of records how can i do this?

greetz

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-01-20 : 09:13:38
select count(*) from yourTable

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-01-21 : 03:39:45
select rows from sysindexes where id = OBJECT_ID(myTable) and indid < 2

This query will probably be quicker , but is not as reliable as : SELECT count(*) from myTable

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2008-01-21 : 09:59:05
or

SELECT rows FROM sys.partitions WHERE object_id = object_id('YourTable');
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-21 : 10:55:48
quote:
Originally posted by jackv

select rows from sysindexes where id = OBJECT_ID(myTable) and indid < 2

This query will probably be quicker , but is not as reliable as : SELECT count(*) from myTable

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com



Provided you run DBCC updateusage for accuracy

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nheijmink
Starting Member

8 Posts

Posted - 2008-01-26 : 11:06:31
tnks 4 your help
Go to Top of Page
   

- Advertisement -