>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