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
 Transact-SQL (2005)
 how to count total records

Author  Topic 

udaymahajan
Starting Member

17 Posts

Posted - 2008-10-06 : 09:14:38
i want to find out total records, for this i try this query

SELECT ROWS AS TOTALROWS FROM SYSINDEXES WHERE ID= OBJECT_ID('RuleCatagoryLanguage') AND INDID <2
AND (RuleCatagoryLanguage.RuleCatagoryID=4)and (RuleCatagoryLanguage.LanguageID=12)

so how can i find total records using sysindexex method to optimize query

uday

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-06 : 09:30:17
SELECT rows FROM sysindexes WHERE id = OBJECT_ID(’table_name’) AND indid < 2


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-06 : 09:46:09
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/02/different-ways-to-count-rows-from-a-table.aspx

Madhivanan

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

- Advertisement -