Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put OUTPUT
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
01673317
Message ID:
01673324
Vues:
39
>>>In the UPDATE I set the new value of the column QTY_LEFT. And then, based on the value in this column, I have to set the value of the column REC_ID. So, my understanding - since the order of evaluation is not certain - to use the New Value of the column QTY_LEFT when setting the value of REC_ID.
>>>So, my question, can I SET the value of column REC_ID after I have the OUTPUT command?
>>
>>It will be a new separate UPDATE command.
>
>Then, if I understand this correctly, I have to do the Select Top(1) twice. That is, the "long" UPDATE command finds the oldest (chronologically) record in the table. Then it update the column QTY_LEFT.
>Then, I have to find this record again, in order to use the OUTPUT variable and update the column REC_ID.
>Do I understand the sequence correctly?

If your table has PK column, get it in OUTPUT table.

May be you if you give more information of what you're trying to achieve, post DDL and some info of before and after, you'll get better response.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform