I need to create a sql job out of stored procedure to insert and update in one. Picking up 200 records inserting it and updating those records status.
I have something like below. Till
Insert Into Table
SELECT TOP 200
Where status IS NULL
-- Till above it is fine the question is below on how to update the status for the inserted records above. So, in next run it picks up TOP 200 again with status as NULL and is unique
set status = 'Inserted'
Question: How to update the status for only the row that are inserted ?