Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foreign Key Constraint
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Database management
Miscellaneous
Thread ID:
01457746
Message ID:
01457747
Views:
50
This message has been marked as the solution to the initial question of the thread.
>Hi,
>
>Can anybody see what is wrong with the following statement to create a foreign constraint:
>
>
>use [MyDatabase]
>go
>alter table [dbo].[Activity] add constraint [FK_Activity_Reference]
>foreign key ([Reference])
>references [dbo].[luActivReference] ([ActivRefer])
>
>
>The error message I get is:
>
>
>The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Activity_Reference". 
>The conflict occurred in database "MyDatabase", table "dbo.luActivReference", column 'ActivRefer'.
>
>
>What should I be looking for in the column ActivRefer?

It means you have values in the column ActivRefer that don't conform to the constraint, in other words, they don't have parents in the luActivReference table.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform