Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL UPDATE Question
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01090513
Message ID:
01090514
Views:
9
>Is there any way to do the following with one command, such as a batch update?
>
>
>
>SELECT MyTable
>SCAN
>
>  cCommand = "update thesqltable set thefield = 'This Value' where id = " + TRANSFORM(MyTable.id)
>
>  =SQLEXEC(nHandle, cCommand)
>
>ENDSCAN
>
I think this post must be in VFP Forum, not here, but:
SELECT MyTable
lcList = []
SCAN
  m.lcList = m.lcList + IIF(EMPTY(m.lcList),[],[,]) + TRANSFORM(MyTable.id)
ENDSCAN
cCommand = "update thesqltable set thefield = 'This Value' where id IN (" +  m.lcList + ")"
=SQLEXEC(nHandle, cCommand)
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform