Sample Header Ad - 728x90

Can't drop and recreate FK in SQL

1 vote
1 answer
104 views
I have a DBCC check that will always fail with the following error: > Msg 8992, Level 16, State 1, Line 2 > Check Catalog > > Msg 3853, State 1: > Attribute (referenced_object_id=517752334,key_index_id=1) of row (object_id=660509732) in sys.foreign_keys does not have a matching row (object_id=517752334,index_id=1) in sys.indexes. I have found the problem where the referenced_object_id is wrong and needs to be changed to 517785102 for FK_SytModuleStat_SytModule. I can't change it in sys.foreign_keys and I can't drop and recreate the FK_SytModuleStat_SytModule in the SytModuleStat to fix the problem. The only problem is that the FK is no longer correct when I try to modify it, I see that the primary/unique key base and column fields are blank compared to a working one. I have tried many suggestions with alter, drop create, set emergency etc. But I can't fix this one key! I have tried to connect with DAC in single user mode and it won't let me enable ad hoc updates even with the reconfigure overrride option. I get this error: > Ad hoc updates to system catalogs are not allowed. DBCC repair with data loss won't work, and there doesn't seem to be a repair catalog feature in SQL Server 2014 Express Edition.
Asked by Dominic Legendre (13 rep)
Nov 2, 2022, 04:14 PM
Last activity: Nov 6, 2022, 06:17 AM