Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Peculiar foreign key problem...

Author  Topic 

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-04-29 : 07:43:12
Have any of you guys ever had a problem with a foreign key constraint not working like its supposed to? I've just spent a good half hour trying to insert a row of data to a table with an FK and regardless of what I did I would only get the error "The INSERT statement conflicted with the FOREIGN KEY constraint...". This would have been perfectly normal if it wasn't for the fact that the value I was inserting was 100% valid.

After pondering around trying to figure out what the heck was going on I then disabled the FK constraint, saved the table definition, re-enabled the constraint again and saved the table all using the SSMS GUI. Without doing *anything else whatsoever* the insert now worked like a charm.

Have any of you seen this before? This is on a SQL 2008 R2 Standard...and unfortunately I haven't been able to reproduce the problem.

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2011-04-29 : 19:17:22
I haven't seen this but I did have a Database User Disabled error message which sent me into an alternate universe. I still can't discern WTF happened there.

=======================================
Elitism is the slur directed at merit by mediocrity. -Sydney J. Harris, journalist (1917-1986)
Go to Top of Page
   

- Advertisement -