using "top 1" or "exists" or other method performance ideas
Posted on 2008-10-03
I have code that needs to know if any rows exist before deciding to do something. I'll make a stored procedure for the code.
My select statement would be
select * from table1 where col1=value
I only want to know if any rows exist that match the criteria following the where clause.
"select top 1 ..." would be an improvement, I think.
Would "exists" syntax be even better? What would the "exists" statement look like?
Thanks for any ideas.