cancel
Showing results for 
Search instead for 
Did you mean: 

HOWTO: Build Compound Primary Keys

Former Member
0 Kudos
128

Unbelievable. No matter what I solution I come up with these two columns Code and Name just get in the way. There's is no way to program around them.

If I opt to take these two columns to fill them with my content then I can't run an INSERT query in a Child table. How can one build a Parent/Child relationship with these fields on the way if I can't repeat the value on these ? Ridiculous!

It's absurd! There's no way to overcome all logical shortcomings and the difficulties provoked.

I need to find a way to a build <b>compound primary key</b> but I can't go directly to the tables and do that on SQL Server according to SAP. I have not seen anything on this subject matter on the documentation!

If someone has come up with a solution to this please let me know !

Accepted Solutions (1)

Accepted Solutions (1)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I don't understand your problem.

You are forced to fill Code and Name and they are primary keys, ok.

But you can fill this columns with no matter what unless they have a unique value, for example a counter.

In your child table you can then add other fields and primary keys as you need, then you build your relation with your fields and only fill the Code/Name values with a counter that you don't take care.

Could it work for you?

Hope it helps

Trinidad.

Former Member
0 Kudos

Trinidad ...

Thanks for your help. I already just have done that, filling this two very bothersome fields with counters. Makes no sense but its a workaround that's working!

Former Member
0 Kudos

What Neftali is talking about is that %90 of the time(for me anyway), Code and Name are useless information. The data in each field must be unique. This forces me to use a unique number. What would be nice is if the combination of the two fields had to be unique NOT each field.

Randy

Former Member
0 Kudos

Randy ...

Another thing that these two fields makes impossible to declare your own primary keys or compound primary keys. It's impossible to override the logic of these to required fields as I have found out. So you're own business logic of entities on the database has to be rethink entirely!

Good luck!

Answers (0)