sql server - Is it equivalent to add a foreign key to an already existent table's already existent field with already existent records than recreation?
I have three
tables: A, AB and B.
A.ID and B.ID are
primary keys. 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
tablewith the same structure
Migrate all records from AB there
Remove all records from AB
Change the structure of AB to have two
Copy the data back
Remove the temporary