Avatar of Kiran Sonawane
Kiran Sonawane
Flag for India asked on

Datatable

There is a dataset. It has two tables and contains a foreignkey constraint between the two tables. During the data insertion, the primary key of the parent table is changed. Will the change be affected in the child table
before inserting the child data?
.NET Programming

Avatar of undefined
Last Comment
guvera

8/22/2022 - Mon
guvera

Hi,

  Are your relationships using

ON UPDATE CASCADE If they are then changing the key in the primary table will update the foreign keys.

e.g.

ALTER TABLE Books  ADD CONSTRAINT fk_author  FOREIGN KEY (AuthorID)  REFERENCES Authors (AuthorID) ON UPDATE CASCADE  

Hope it may helpful to you.

Thanks
Guvera
ASKER CERTIFIED SOLUTION
guvera

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck