SQL Server Management Studio – Creating Foreign Key Relationships on Tables with Data

Using the Database Diagram, you can create a Primary/Foreign Key relationship between two tables. But if the tables already have data, the relationship will fail to establish. If you are sure you won’t have orphaned data, the resolution is to set the ‘Check Existing Data On Creation Or Re-Enabling’ = “No” within the Foreign Key Relationships dialog box. The dialog box can be accessed when creating the relationship or by right clicking the table on the diagram and choosing ‘Relationships’.

Check Existing Data On Creating Or Re-Enabling