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:
01457749
Views:
31
>>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.

Oh, I see. This is what the message means. Thank you. I will check all values in the table.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform