cancel
Showing results for 
Search instead for 
Did you mean: 

CDS Create Identity Column within entity

Former Member
0 Kudos

Hello everyone,

i set up one database model on my hana trial instance. but within the cds syntax i am not able to find to define autoincrement functionality to the key column. somebody how to implement this?

Suppose i have the following entity:

entity A {

key column1: Integer,

column2: String(10)

}

Thanks!

Best regards,

Manjinder Singh

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

Hello Manjinder,

in CDS this still cannot be defined directly.

You have to use a sequence for that (Sequence Configuration Syntax - SAP HANA Developer Guide for SAP HANA Studio - SAP Library).

Best Regards,

Florian

Former Member
0 Kudos

Ok,

it is sufficient to define the .hdbsequence file within the online workbench. Means i create the sequence file and define for the corresponding column the autoincrement parameter for instance to 1. Afterwards i activate it on hana xs. Or i have to reference the sequence file within the cds file?

best regards,

Manjinder Singh

pfefferf
Active Contributor
0 Kudos

You do not have to reference it in the CDS file. The sequence is independent from the entity. When you do an insert into your entity table you have to supply the field for which you wanna use the incremented value with the next value of the sequence.

Best Regards,

Florian

Former Member
0 Kudos

Ok thanks.

Answers (0)