Bit rusty on the sql side as I have not touched in a while
I have added a foreign key constraint using the Diagram and clearly says that there is a fk relationship.
However when scripting the table or viewing the keys in SQL Server explorer I cannot see the grey key.
Am I missing something?
Not sure I am doing it correctly.
How do you create one programatically between 2 tables? Should it appear in the Explorer under keys?
Thanks a lot for any input
To create the FK relationship, use this syntax:
and possibly define what happens on UPDATE or DELETE of the primary key in the parent table:
You should be able to query the data dictionary views to check if that FK constraint is really in there:
This will list all existing foreign keys in your current database.