Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can string-fields in tables result in missing referential integrity.

Former Member
0 Kudos
137

Hi everyone,

When I use attribute fields of type string in a table and I define a foreign key for that table with a check table,

than there is no referential integrity for this relation.

The defined foreign key has nothing todo with the attribute-field, here is an example:

ZT01 (check table)

mandt (s_mandt, clnt,3)

pk1 (numc, 10)

description (string)

ZT02 (first referring table, which works fine).

mandt (s_mandt, clnt,3)

pk1 (numc, 10)

fk1 (z_id, numc, 10)

ZT03 (second referring table, with no referential integrity).

mandt (s_mandt, clnt,3)

pk1 (numc, 10)

fk1 (z_id, numc, 10)

description (string)

In both cases the foreign key gives an impliciet help screen with the correct values.

The only difference is the additional field description in table ZT03.

This results in a foreign key relation without referential integrity!

Why?

regards,

Jan

2 REPLIES 2

Former Member
0 Kudos
98

Hi Jan,

"The only difference is the additional field description in table ZT03.

This results in a foreign key relation without referential integrity!"

I guess this part of the definition answers the question

"When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table".

Mohinder

Former Member
0 Kudos
98

Hi Mohinder,

Sorry, but I do not agree with that.

The field 'description' is part of the referring table.

As far as I know, both tables in a fk-relation can have each his own attributes/fields.

There are no restrictions on that level.

regards,

Jan