Can the sql scheduler yield in the middle of a session?
We have a stored procedure that is executed by multiple clients. The stored procedure grabs an integer value from a table, updates the table to increment the value, and then returns the originally grabbed value to the client - very straight forward. BEGIN TRAN SELECT @var = somevalue FROM TABLE WHERE [somecondition] UPDATE TABLE SET somevalue = somevalue + 1 WHERE [somecondition] RETURN @var COMMIT TRAN We had an issue a few days ago where two clients ended up with the same value from this proc. We're trying to figure out how this happened, and the only thing my simple mind can think of is that sql yielded right after the select @var=. At that same moment, another sql thread/scheduler called this procedure and ended up grabbing the same value. What do you all think? Am I way off on this? -Brian