What is the best way to convert 'yyyy-mm-dd' to the Teradata interger storage of a date? (yyyy-1900)mmdd
If my date was April 1, 2012 and it was stored in the database column in the format 'yyyy-mm-dd'.
This is what I am trying to get: 1120401
Is this the best way or is there a different way that is more efficient?
select cast(current_date as INTEGER) myTest
This is the best way, because there's no conversion neccessary as it Teradata's internal format.
But way do you need it?
"stored in the database column in the format 'yyyy-mm-dd'" is not correct, a DATE is always stored using an integer as you described, the format used for a cast to a string is controlled by the FORMAT string.