Hi
Two table are tied with each other because of FK constraint. I am trying to update these tables by disabling ALL Trigger but still getting the following error :-
The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_TEST_REFERRING_REFPHYSI". The conflict occurred in database "ccdb", table "dbo.RefPhysician", column 'RefID'. The statement has been terminated."
Thats how I am trying to accomplice my task. Please help or update the following T-SQL:-
Begin Transaction
Begin Try
ALTER TABLE Test DISABLE Trigger ALL
ALTER TABLE RefPhysician DISABLE Trigger ALL
UPDATE Test
SET RefID = '05f6c6b4-63ff-45b2-a5e2-920d5dce3e45'
WHERE RefID = '05e6c6b4-63ff-45b2-a5e2-920d5dce3e45';
UPDATE RefPhysician
SET RefID = '05f6c6b4-63ff-45b2-a5e2-920d5dce3e45' ,
SpecID = NULL ,
RefLastName = '117002 DR. BRAD DIBBLE' ,
RefFirstName = '201-190 CUNDLES RD E, BARRIE ONT L4M 4S5' ,
RefMiddleName = NULL ,
RefPhone1 = '6138365083' ,
RefPhone2 = 'print,read,866,1' ,
RefFax = '6476476464' ,
RefEmail = '[email protected]'
WHERE
RefID = '05e6c6b4-63ff-45b2-a5e2-920d5dce3e45'
ALTER TABLE Test ENABLE Trigger ALL
ALTER TABLE RefPhysician ENABLE Trigger ALL
Commit Transaction
End Try
Begin Catch
Rollback Transaction
End Catch