I just tried the following in Teradata v13 enterprise version
sel case when current_date > 8/25/2012 then 'yes' else 'no' end as output
Today is the 24th of August . I get the output as 'yes' which is logically wrong. The statement works fine with dates <= current_date , but fails for future dates.
Any answers ?
It's not a TD bug, it's buggy logic :-)
8/25/2012 is not a date it's a calculation involving integers which results in 0.
Try CURRENT_DATE > DATE '2012-08-25' instead.
SELECT '2012-02-10' - EXTRACT(DAY FROM '2012-02-10')
Answer set is 20120200.00
I've mentioned it in single quotes to identify it as char. But database process this as integer expression. Shouldn't be an error in this scenario?
Casting as DATE works fine as dieter mentioned.
SELECT '2012-02-10'; --Output: '2012-02-10'
SELECT 2012-02-10; --Output: 2000
/* This scenario donot convert char -> integer */