0

We have a table in the HANA DB with two columns of following data types

DeliveryDate : SECONDDATE// store values like : 2010-01-11 13:30:00
NewDeliveryDate : Date // will store values like: 2010-01-11

How to write sql script to extract the date value from the source column(DeliveryDate) to the target column (NewDeliveryDate) ?

Could you help us with suitable HANA SQL script function to achieve this

1 Answers1

1

Assigning the date part of a seconddate data type to a date data type does not require using a SQLScript function.

It is sufficient to perform a type conversion and this can even be an implicit conversion during a value assignment.

// implicit conversion by assignment
// assigning the seconddate value to a date data type implicitly converts the value, leaving the date part

NewDeliveryDate = DeliveryDate;     

// explicit conversion 
// this is the preferred option as it makes the conversion explicit. 
NewDeliveryDate = to_date(DeliveryDate); 

Check the documentation for details on the conversion functions.

Lars Br.
  • 9,949
  • 2
  • 15
  • 29