INSERT stuff
SET computed = 'working'
WHERE id = (SELECT max(id) from STUFF WHERE x = y)
I would like to make this statement atomic in SQL Server 2005 SP 1.
Is there a way of doing this without modifying the isolation level?
I need to simulate an insert into a table with an Identity column as the pk. My current table doesn’t have an Identity field as the pk but it needs to act like it does. So i need to get the max of the pseudo ID field and add 1 then insert the next row.
To lock the value down, one way is to to use SERIALIZABLE isolation level.
Make sure to keep it as short as possible.