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
 what's the difference

Author  Topic 

JJ297
Aged Yak Warrior

940 Posts

Posted - 2011-06-16 : 11:55:18
I want to get dates over 300 Days

this way...
and (Datediff(DAY, conv_flg_cdt, Getdate()) > 300)

or this way...

and conv_flg_cdt< dateadd(dd,-300,getdate())

Which one is correct please and why?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-06-16 : 12:01:16
Both are correct, the 2nd one will perform better if there's an index on that column.
Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2011-06-16 : 12:10:59
Okay thanks!
Go to Top of Page
   

- Advertisement -