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 2000 Forums
 Transact-SQL (2000)
 Query reg execution speed - AND, OR conditions

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-01-18 : 08:48:59
prema writes "I need to know which condition executes faster in SQL - "AND" or "OR". Kindly let me know"

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-18 : 09:28:30
It depends on what you are comparing with.
Generally, OR might be faster since the first evaluation is true, there is no need to evaluate next comparion.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2007-01-18 : 23:36:53
The questions is completely meaningless. The data you need determines whether you need to use AND/OR - they are not interchangeable. The nature of the query determines the speed.
Go to Top of Page
   

- Advertisement -