cancel
Showing results for 
Search instead for 
Did you mean: 

How to use CURRENT_TIMESTAMP function in hdbtable

Former Member
0 Kudos

Anyone can hint me what is the correct syntax to set dedault value of a timestamp field to current time?

table.columns = [

  { name = "TIMESTAMP";  sqlType = TIMESTAMP;  nullable = false; defaultValue="current_timestamp()"; },

  { name = "USAGE";  sqlType = INTEGER;  nullable = false;  }

];

Thanks!

Yue

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can not use SQL Functions in such a way in HDBTABLE.  However you can use them as of SPS 10 in HDBDD table definitions.

former_member194780
Active Participant
0 Kudos

Hi Yue,

You cannot set current_timestamp or now()  as a defaultValue to TIMESTAMP datatype. Infact defaultValue cannot for used for TIMESTAMP datatype. Incase you need the current time then use these functions in your SQL Script

Below is the Column Definition that we can use for .hdbtables:

struct ColumnDefinition {

string name;

SqlDataType sqlType;

optional bool nullable;

optional bool unique;

optional int32 length;

optional int32 scale;

optional int32 precision;

optional string defaultValue;

optional string comment;

};

-Avinash