Skip to main content
Question

I want to add days to a date in vertica SQL in transformations.I have tried using DATEADD and TIMESTAMPADD, both are showing permission denied.Please help how can i achieve this.

  • July 10, 2024
  • 3 replies
  • 26 views

gauri.pai11
Level 3
Forum|alt.badge.img+3
I want to add days to a date in vertica SQL in transformations. I have tried using DATEADD and TIMESTAMPADD, both are showing permission denied. Please help how can i achieve this.

3 replies

mateusz.dudek14
Level 11
Forum|alt.badge.img+11

Hi,

 

TIMESTAMPADD works fine for me. Probably you messed up the syntax.

Adding a screenshots of something 'not working' usually make easier to help.

 

Code:

SELECT TIMESTAMPADD (DD, 2, (SELECT TRUNC((CURRENT_TIMESTAMP), 'MM'))),

 TRUNC((CURRENT_TIMESTAMP), 'MM') AS Initial_timestam ;

 

Documentation: TIMESTAMPADD (vertica.com)

 

Screenshot:

image 

Mark as best answer if helped, and let us know if that worked :)

 

Best Regards,

Mateusz Dudek


Hello, U can try something like this, this will work.

 

To add days: TIMESTAMPADD('day',1,GETDATE())

To minus days: TIMESTAMPADD('day',-1,GETDATE())


kandi.naidu
Level 7
Forum|alt.badge.img+6
  • Level 7
  • 27 replies
  • July 17, 2024

Hi @chaithanya.reddy11 ,

 

If you're getting TIMESTAMPADD is not supported while running the syntax in transformation. Please raise a feature request. Valid Engineer will add TIMESTAMPADD in your environment.