Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating SQL Server table
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01655887
Message ID:
01655900
Views:
46
>>>>Hi,
>>>>
>>>>I am calling SQL Update command from VFP application. Since I don't know if the matching record is found in the SQL Server, I want to have the results; so that I can count how many record were updated. I thought I can add the name of a cursor and "capture" this. But it does not seem to work. Here is what I am doing:
>>>>
>>>>
>>>>cSqlUpdate = "update mytable set field1 = '1233' where id_field = 'ABC'"
>>>>nResult = SQLEXEC(hCon, cSqlUpdate, "cur_result")
>>>>
>>>>
>>>>I thought that the cursor "cur_result" would be created on successful update. But Select ("cur_result") is 0 after an update that I see worked. What am I missing?
>>>>
>>>>TIA
>>>>
>>>
>>>UPDATE statement do not create cursor.
>>
>>Thank you.
>
>
>If you want updated records as cursor than you ca use OUTPUT statement:
>
>cSqlUpdate = "update mytable set field1 = '1233' where id_field = 'ABC' OUTPUT INSERTED.*"
>nResult = SQLEXEC(hCon, cSqlUpdate, "cur_result")
>SELECT cur_result
>BROW NORMAL
>
Thank you. What is the purpose of the word "INSERTED.*" in your code above? I am updating (not inserting).
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform