Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i use below query for count total rows from table and it's working.
SQL
SELECT [rows] FROM sysindexes
WHERE id = OBJECT_ID('dbo.tableName') AND indid < 2

--instate of 

SELECT COUNT(*) FROM tablename 


now i have to apply where condition like
SQL
SELECT COUNT(*) FROM tablename  where [EntryDate] between ('10/10/2013') and ('01/01/2014')


now i have to apply this where condition in my first query. HOW.??

Please help.

Thanks in advance.
Posted
Updated 11-Jan-15 19:33pm
v3
Comments
DamithSL 26-Dec-14 0:36am    
you may have where condition which may true for all the rows
ZurdoDev 26-Dec-14 14:02pm    
What's your problem?

1 solution

I think this is not possible using first query second query is the only option. The reason is the sysindex table stores the total number of rows in the table and NOT filtered rows.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900