September 9, 2011 at 12:49 am
Hi All
We are using a convert function for date column in where condition and doing comparison. BUt its not working as it has to
( Report date >= Effective start date )
'2010-02-09 00:00:00' >= '2011-31-08 00:00:00' after conversion it becomes (9/2/2010 >= 8/31/2011 ) . The type used is 101 in convert function. But the same condition is working fine for other types like 102,103 .
this condition should be failed as report date is less than effective start date however the condition is passing because of the use of date type convert function.
Please let me know why when using convert function for 101 the behaviour is different.
Cheers
Sowmya
September 9, 2011 at 1:33 am
sowmya.boodaderureddappa (9/9/2011)
Hi AllWe are using a convert function for date column in where condition and doing comparison. BUt its not working as it has to
( Report date >= Effective start date )
'2010-02-09 00:00:00' >= '2011-31-08 00:00:00' after conversion it becomes (9/2/2010 >= 8/31/2011 ) . The type used is 101 in convert function. But the same condition is working fine for other types like 102,103 .
this condition should be failed as report date is less than effective start date however the condition is passing because of the use of date type convert function.
Please let me know why when using convert function for 101 the behaviour is different.
Cheers
Sowmya
The reason why is because you're now sorting characters instead of dates. Don't use CONVERT for anything expect for, maybe, a final output to a file. Other than that, you should let the app or the report generator format the date for fnal display.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy