0

I have three column as Date1 in format(2016-12-31) then another column Term is (3 Years) then i want to do operation on date to add three years in Date1 field and result would be Dummy Column(2019-12-31)

I have syntax logic stagement from datastage, same i need to put into SQL

datastage syntax - DecimalToString(StringToDecimal(DSLink17.Date1 [1, 4],'ceil') + StringToDecimal(DSLink17.Term [1, 1], 'ceil'), 'suppress_zero') : DSLink17.Date1 [5, 6]

2 Answers2

0

If you want to add year to the date,you can try something like this

select dateadd(year, Term::int, to_date(Date1)) as dummy_column ;

However its not very clear from the question , is column Term present as just 3 or 3 Years in the database, if its just 3 go with the above query else use something like this to split the string

select dateadd(year, split(Term,' ')[0]::int, to_date(Date1)) as dummy_column ;
Somu Sinhhaa
  • 143
  • 2
  • 16
0

You might do better to ask this question in a Snowflake forum.

Ray Wurlod
  • 831
  • 1
  • 4
  • 3