Reputation: 151
select ansidate(xxx) + '3 months' AS date1
from (
select str_to_date(varchar(max_date),'%Y%m%d') as xxx
from comp_stg_rundate
where row_key = 1
)as s
Max_date is saved as an interger in the comp_stg_rundate table, I want to add 3 months onto this date. The fuction DateAdd won't work as I am using VectorWise.
Upvotes: 1
Views: 305
Reputation: 446
What version of Vectorwise did you run this against because it works for me on VW 4.0.
However this also works.
timestampadd(MONTH,3,ansidate(xxx))
Upvotes: 0
Reputation: 2523
Ok, I don't know VectorWise or how ansidate is stored, however, if it's stored as an integer value I assume it represents a certain amount of time, measured on a specific time unit since a starting time point.
If it's true, you can convert your 3 months to the time unit in which ansidate is being stored and add the converted value.
Upvotes: 0