cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal(19,0) to Datetime column conversion

former_member198401
Active Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187605
Active Contributor
0 Kudos

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.

former_member198401
Active Contributor
0 Kudos

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