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.
| Author |
Topic |
|
o0o0o
Starting Member
1 Post |
Posted - 2006-06-13 : 04:29:54
|
| Which is more efficent and why:1) where abs(datediff(day,@date,table1.date)) <12) where table1.date between @dateFrom and @dateTo3) where table1.date >= @dateFrom and table1.date <= @dateToThanks |
|
|
cmdr_skywalker
Posting Yak Master
159 Posts |
Posted - 2006-06-13 : 04:53:49
|
| 2 is converted to 3 in the execution plan.1 uses more computation and does not use an index (that is, if you have index on the table1.date). i'll use 2 or 3.May the Almighty God bless us all! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-13 : 05:27:05
|
| If there is index on the date column then 2 and 3 are best to useMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|