0

I have two tables tblA and tblB. And a constraint called tblA_tblB_FK is created between these tables. I wanted to update both columns in tables chained with tblA_tblB_FK constraint. While reading different posts I thought the best way is to disable the constraint for a moment and enable again after the update. For that reason I executed these queries:

alter table tblA NOCHECK CONSTRAINT tblA_tblB_FK

After this step I did the update and till now everything was OK, but then I tried to enable again the constraint, so I executed this query:

ALTER TABLE tblA CHECK CONSTRAINT tblA_tblB_FK

and it says command successfully completed. But when I try to make update again it doesn't stop me from doing that, meaning there is a problem with the enabling process. I tried to execute another query:

ALTER TABLE tblA WITH CHECK CHECK CONSTRAINT tblA_tblB_FK

and it doesn't allow me complaining there is tblA_tblB_Fk constraint active. I don't understand why it allows me to make an update, while it doesn't allow me to execute this command?

I am using SQL Server 2005. Thanks in advance for any suggestions!

jarlh
  • 42,561
  • 8
  • 45
  • 63
Rey
  • 3,663
  • 3
  • 32
  • 55

1 Answers1

0

Check you insert and update specification for the foreign key in management studio under Table>Table_name>Keys folder. It might be set to "Cascade".

Akshey Bhat
  • 8,227
  • 1
  • 20
  • 20