I have three table
s: A, AB and B.
A.ID and B.ID are int
primary key
s. AB.AID and AB.BID are int and (AID, BID) is the primary key
of AB.
I need to make sure that AB.AID will be a foreign key
which will reference A(ID) and AB.BID will be a foreign key
which will reference B(ID).
If I, using Microsoft SQL Server Management Studio right-click the table and click Design and after the table appears I right-click and click on Relationships and add the foreign key
, will I have the very same result as if I would:
Create a temporary
table
with the same structureMigrate all records from AB there
Remove all records from AB
Change the structure of AB to have two
foreign keys
Copy the data back
Remove the temporary
table
?