Quantcast
Channel: SQLServerCentral » SQL Server 2008 » Data Corruption (SS2K8 / SS2K8 R2) » Latest topics
Viewing all articles
Browse latest Browse all 223

Phantom FK violation

$
0
0
I use a proc to delete a row from a PK table, based on a query of "get the PK ids that don't exist in the FK table". The proc fails with an FK violation. The proc does a simple "delete from PK table where pk_id = n"So I delete the PK row manually (delete from PK table where pk_id = n). No complaints. Fine -- well not really, but...Verified that the row does not exist in either the PK nor FK tables.So I:- DBCC'ed, no errors reported. - Dropped and re-created the FK WITH CHECK. No complaints.- Call the proc again just for good times, and still get the FK violation????? - Put the delete statement in the sproc into a try...catch block to the sure it was actually failing at that point, confirmed. There are no triggers on either table.There must be a SNAFU somewhere. Can someone point me in the right direction?Thanks!

Viewing all articles
Browse latest Browse all 223

Trending Articles