Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Cascade FK values from VFP?
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01537208
Message ID:
01537228
Vues:
24
>>>>Hi,
>>>>
>>>>I am creating a procedure in the VFP 9 application that will Cascade update of all FK values in child tables when user changes the value of unique field in the parent table. What I do is set "transactions" to 2 (via SQLSETPROP) and then update Parent table and then Child Tables. But I get error that the update conflicts with the Foreign Key constraint set in the SQL Server on a Child table. I thought that the "transaction" will take care of it. So is there a way to get around this? Is there a way to make SQL Server ignore the constraints until the Transaction is finished? Any other suggestions? TIA.
>>>
>>>I suggest to use SQL Server transactions, e.g.
>>>
>>>BEGIN TRANSACTION
>>> UPDATE Parent
>>> UPDATE Child
>>>COMMIT TRANSACTION
>>
>>I thought that calling the following from VFP does use SQL Server transaction.
>>
>>
>>lnResult = SQLSETPROP( nConnHandle, "TRANSACTIONS", 2 )
>>
>>
>>Am I wrong?
>
>I am not sure - I prefer to use BEGIN TRANSACTION myself instead.

I tried that and it does not work either. That is I replaced the code of SQLSETPROP with
SQLEXEX( nConnHanlde, "BEGIN TRANSACTION" ) but to no avail.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform