troubleshooting Question

is it possible to setup a foreign key while data is in the table

Avatar of al4629740
al4629740Flag for United States of America asked on
Microsoft SQL Server
23 Comments3 Solutions185 ViewsLast Modified:
I have a table where data already resides.  I am trying to setup a foreign key but got the following error message

'tblOrgRegistrations' table saved successfully
'tblOrgHours' table
- Unable to create relationship 'FK_tblOrgHours_tblOrgRegistrations'.  
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_tblOrgHours_tblOrgRegistrations". The conflict occurred in database "CAPRegistration", table "dbo.tblOrgRegistrations", column 'RegID'.

Is it possible to setup a foreign key while data is already present for RegID?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 23 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 23 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros