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:
01306810
Vues:
5
>>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?
>
>It would not work in SQL Server, correct. One way would be to translate each update as a separate line and use a batch.

Thank you.
"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
Répondre
Fil
Voir

Click here to load this message in the networking platform