To Add a foreign key to a column in an existing table, use ALTER TABLE ADD CONSTRAINT
ALTER TABLE dbo.President_Lookup ADD CONSTRAINT fk_PresidentID FOREIGN KEY (PresidentID) REFERENCES dbo.Presidents (PresidentID)
Popular search terms:
To Add a foreign key to a column in an existing table, use ALTER TABLE ADD CONSTRAINT
ALTER TABLE dbo.President_Lookup ADD CONSTRAINT fk_PresidentID FOREIGN KEY (PresidentID) REFERENCES dbo.Presidents (PresidentID)
I have 1 query.
I have 2 tables, one is master and another is normal table.
the primary key of one table is used in 2nd table…
bt I dont know, how I can set that key will foreign..????
please send mi feedback on my email…
or give mi an example code for setting foreign key…
THIS IS NOT WORKING