Skip to Content

Decimal(19,0) to Datetime column conversion

Hi All,

Do we have to explicitly specify any format specific to HANA datetime for converting a decimal column in SQL server(Source) to Datetime column in HANA(Target)

I placed a temporary table in SQL server and was able to convert the decimal value to datetime

Source Column Data:

20171005153731

to_date(Query.AUDITSTARTTIME,'YYYYMMDDHH24MISS')

Target Column in SQL Server Table

2017.10.05 15:37:31.000000000

But when I try to use to_date function for HANA column mapping it doesnt work

Any inputs would be appreciated with karma points

Regards

Arun Sasi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 19 at 05:36 PM

    What's the generated SQL code in both cases? Is the SQL pushed down to the database?

    That will all make a difference. An implicit conversion will always be done, if you don't explicitly specify the format. So you may be lucky, you may be not.

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Dirk!!

      The below conversion works fine to_date(cast(AUDIT_START_TIME,'varchar(24)'), 'YYYYMMDDHH24MISS')

      If we simply do the below conversion, it will print NULL as HANA does not understand the character conversion, therefore we have to cast it as varchar(24).

      to_date(to_char(AUDIT_START_TIME, 'YYYYMMDDHH24MISS'), 'YYYYMMDDHH24MISS')

      In both the cases DS generates does not add any conversion function (SQL in Validate SQL) for the Audit Start Time and Audit End Time columns

      Regards

      Arun Sasi