Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Cascade FK values from VFP?
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01537208
Message ID:
01537237
Views:
22
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform