Adding a relationship constraint to an existing or new column in MS SQL

24 Mar 2016 Databases, SQL, Stored Procedures No Comments

I recently needed to write some SQL to add a relationship constraint to an existing column in MS SQL. After a bit of research this is the answer I found. I have also included the SQL for adding the same constraint when creating a new table also.

 

Alter an existing table

Add a new table

Resource:
https://msdn.microsoft.com/en-GB/library/ms189049.aspx