Search code examples
mysqlsqldatehananvarchar

SQL Query nvarchar to date


I am working on SAP HANA Studio and have tried to run SQL command that converts an entire column of field, nvarchar, into one of field, date.

My dates have format: dd-mon-yyyy (i.e '29-Mar-1997') with field nvarchar(11).

I have looked at previous questions and SQL command documentation (for functions like CAST, CONVERT, TO_DATE, STR_TO_DATE) and have not gotten a solution.

Typical errors I get are: Function not recognized, or, Error while parsing Service Date as DATE at function to_date().

Any suggestions?

Thanks -Diana


Solution

  • Try TO_DATE():

    select to_date(col, 'DD-MON-YYYY')