1
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.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
user3399863
  • 151
  • 1
  • 1
  • 7
  • Don't know vectorwise, but what about adding the interval *before* converting the data to this ansidate thing: `ansidate(xxx + interval '3' month)` –  Nov 19 '14 at 12:48

2 Answers2

0

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.

Bardo
  • 2,470
  • 2
  • 24
  • 42
0

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))
Ajay2707
  • 5,690
  • 6
  • 40
  • 58
PaulM
  • 446
  • 2
  • 12