Search code examples
sqldatetimedatetime-formatinformaticainformatica-powercenter

SQL Command to convert YYYYMMDD to YYYY-MM-DD


I am facing an operand type clash error due to this issue (in Pre-SQL Informatica) that says the date is incompatible with int, even though the date in target table is defined as datetime. How can I convert the existing YYYYMMDD date to YYYY-MM-DD format for my query?


Solution

  • You can try using this:

    to_char(to_date(your_date, 'YYYYMMDD'), 'YYYY-MM-DD') 
    

    or

    TO_DATE(your_date as String, 'YYYY-MM-DD')