please need help with conversion below:
a.OfferDateINT,a.UpdateDate is integer columns
Tnx a lot!
I find this difficult to help you with because you haven't really described the logic. What is this meant to be doing?
What does "ExpDate=convert(DateTime,convert(varchar(100),(a.OfferDateINT),112))+1" achieve?
To me this would return a 'True' or 'False' answer (i.e. boolean) but Teradata doesn't have a Boolean data type.
You say that "a.OfferDateINT,a.UpdateDate is integer columns" which is useful information, but can you provide examples of the numeric values that they would contain for certain dates.
For instance, what integer value would one of them contain for 27 August 2016?
Below are a number of assumptions, telling me if those assumptions are correct or not will help:
Some more information would help.
"ExpDate=..." is proprietary T-SQL syntax assign a column alias (but "... AS ExpDate" is also supported), your other assumptions are right.
The best way to convert YYYYMMDD to a Date is
Cast(OfferDateINT - 19000000 AS DATE)
(Cast(UpdateDate AS INT) + 19000000)
The WHERE-condition is quite stupid as it's converting UpdateDate to a string and then back to the same INT-date.
SELECT Cast(OfferDateINT - 19000000 AS DATE)+1 FROM a WHERE (Cast(Current_Date AS INT) + 19000000) = UpdateDate
First of all - tnx a lot!
You clearly understood the logic.
At the end i need convert integer column like '20170501' to timestamp and that's what SQL do.
In Teradata it's more difficult but i will try dnoeth solution:)