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
 General SQL Server Forums
 New to SQL Server Programming
 plz tell me effiecient one

Author  Topic 

raky
Aged Yak Warrior

767 Posts

Posted - 2008-05-22 : 08:20:50
One doubt regarding keywords ‘in’ and ‘or’.

suppose -> select * from wlcs_order where status in (‘OPEN’, ‘CLOSED’)

select * from wlcs_order where status = ‘OPEN’ or status= ‘CLOSED’

Which one is efficient.

I want the reason also. Please tell me.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-22 : 08:25:41
Both are same in terms of performance.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-05-22 : 12:56:00
I believe that the query parser converts IN into OR as it parses the query. You can run the queries with the execution plan enabled and check the properties of the index seek/index scan and you'll see what the expression was converted to.

--
Gail Shaw
Go to Top of Page
   

- Advertisement -