>>go
>>begin transaction
>> update Salaries set EmpNo = NULL where EmpNo = 'Test1'
>> update Employee set EmpNo = 'Test32' where EmpNo = 'Test1'
>> update Salaries set EmpNo = 'Test32' where EmpNo = 'Test1'
>>commit transaction
>>
>>You should either have CASCADE relation or set the FK value to NULL first. Otherwise it's a "catch 22" situation.
>
>Well.. Cascade in SQL Server does not always work. In case of my database it does not work in a lot of places. So I had to implement it using my own code. I suppose I will have to remove/delete all FK constraints then.
>Thank you.
What about the code I showed? I don't recommend to get rid of constraints as you may end up with orphans in such case.
If it's not broken, fix it until it is.
My Blog