Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to update multiple rows without stored proc
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01306751
Message ID:
01306807
Vues:
3
>>>Hi everybody,
>>>
>>>I know, I should create a test case and try it before asking the questions, but I was wondering how the following works.
>>>
>>>Say you get a cursor from a table, using SPT. Then you update some records of the cursor. Then you want to update the table with the changes. Can it be done without a stored procedure? That is, if I send to SQL Server (using SPT) an update string as following:
>>>
>>>
>>>update mytable from mytable join c_mytable on c_mytable.pk = mytable.pk set myfield1 = c_mytable.myfield1
>>>where (cSomeExpr)
>>>
>>>
>>>My instinct tells me that since SQL Server does not know anything about the cursor c_mytable, the above will fail. Correct?
>>
>>This is more VFP question than SQL Server one.
>>When using SPT you have two choices:
>>1. SCAN through SPT Cursor and send UPDATE for each updated record.
>
>I haven't tried, but I was thinking you can create a script with all update commands and then execute is as a batch? What do you think?
>
>>2. Make SPT Cursor updatable. Check How to make SQL Pass-Through cursor updatable FAQ #8153 and use TABLUPDATE() at the end :-)

O, that is a third way.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform