The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

Syntax to convert Datetime to Date

Hello All,

 

I am very new to Veritica and i am stuck at this issue.

 

I have a column called 'Transactiodatetime' in my Table. I am creating a View on top of this Table but in the View i need a RequestDate column.

 

Below is the Syntax i am using but i am getting an Error

 

select to_char(transactiondatetime,'DD-MM-YYYY') as RequestDate

 

Error - [Error Code: 2005, SQL State: 42601]  [Vertica][VJDBC](2005) ERROR: Multiple decimal points.

 

Can someone please help me getting the correct syntax.

 

Thanks in advance !!

 

Comments

  • edited March 31

    I also have this error. I'm using vertica 9.0.x. I wonder why experienced Vertica folks are ignoring this post for 3 years now as if the error is supposed to be self-explanatory.

    Anyway, I'd like to share that the issue for me was this: I encountered the error because the column that I thought was a TIMESTAMP data type, the column that I used in the TO_CHAR function, was actually of VARCHAR data type.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.