Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to put OUTPUT
Message
From
02/03/2020 09:18:04
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
01673317
Message ID:
01673324
Views:
38
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform