on 2019 Feb 28 1:48 PM
Hi all,
I am struggling with creating foreign key using association in hdbcds. Whatever I tried I either get errors or no foreign key is created.
What would be the syntax in hdbcds file for SQL:
alter table "details" ADD CONSTRAINT "my constraint" foreign key ("header_id") references "header" ("id");
Tables are the following:
header {
key id
}
details {
key id
header_id
}
Many thanks
Anton
Request clarification before answering.
You do not add constraints in HDBCDS. There is not syntax for this in CDS and assocations by intention don't create constraints. Instead create a separate HDBCONSTRAINT object for the target table of the entity in the HDBCDS. I have an example of this in the openSAP course project here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
Thank you, HDBCONSTRAINT worked fine
I read SAP_HANA_Core_Data_Services_CDS_Reference and there is a section Foreign Keys in Associations so I had some difficulties to understand relations between two. Also, HDBCONSTRAINT mentioned there once without any explanation.
Is there a place to read more about this?
Many thank
Anton
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
46 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.