Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Transactions from VFP code
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01546947
Message ID:
01546948
Views:
62
You cannot change parent key involved into FK relationship unless you set Cascade Update. The rules inside transaction are the same as outside. The only difference is that changes are not committed to the actual tables until COMMIT statement (explicit or implicit)

>
>Here is a problem I am having. A parent table has a unique char field (e.g. Custom_ID). The child tables with this field (FK) have FK constraint set on this field. When I edit this field in the parent table (in VFP code) I have a code that would change the value in the parent table and then in all child tables. Before I UPDATE the parent table and any child table I set a transaction as following
>
>
>nRetVal = SQLSETPROP( oApp.conn_handle, "transactions", 2) 
>
>
>Then the code is suppose to update the Parent table first and then each Child table. At the end the SQLCOMMIT() would be called. The problem is that as soon as I update the Parent table I get the error pointing to one of the Child tables REFERENCE constraint. I thought that the Transaction (above) would stop SQL server from updating the tables until commit but apparently it does not work that way. Am I setting the Transaction incorrectly? Or what am I missing?
>TIA
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform