Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL UPDATE Question
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01090513
Message ID:
01090514
Vues:
8
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform