Hi,
I have a SP that I am trying to achieve simultaneous select and update of the same (Top 30) IDs within a table.
The question is, will this update return the same IDs as the first select statement?
Is there a way to assign a variable within the first select statement and then pass those values to the UPDATE?
Thanks,
-b
I have a SP that I am trying to achieve simultaneous select and update of the same (Top 30) IDs within a table.
Code:
SELECT TOP 30 [ID]
FROM Incoming
WHERE Processing = 'N'
UPDATE Incoming set Processing = 'Y'
where Incoming.[ID] in (SELECT TOP 30 [ID]
FROM Incoming
WHERE Processing = 'N')
Is there a way to assign a variable within the first select statement and then pass those values to the UPDATE?
Thanks,
-b