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
 statement is sp blocks records

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2012-06-20 : 11:43:25
-- WHERE OGEN.DATEONLY(END_DATE)- OGEN.DATEONLY(START_DATE) < '1900/03/01'

can you explain this statment to me? If I take it out, I get records, of its in, nada.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-06-20 : 12:05:03
It doesn't make any sense in Microsoft SQL Server. The difference between dates is measured in days, months, years, etc. My guess is that they are trying to say "Did this take less than 3 months?" Which in t-SQL would be something like

WHERE END_DATE <= DATEADD(month,3,Start_Date)

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2012-06-20 : 12:14:02
Thanks Jim.
maybe they converted from this:
WHERE TRUNC(END_DATE) - TRUNC(START_DATE) < 60

this is how it is in the Oracle version of the sp.
Go to Top of Page
   

- Advertisement -