I have a question regarding concurrency in stored procedures. I have a stored procedure with the following flow of control:
-- A couple of select statements here.
-- (placeholder - see below)
-- A couple of updates based on the data obtained
-- from the above select statements.
I'm concerned that while the stored procedure is running, if right when it gets to the spot in the code marked 'placeholder', the scheduling mechanism of SQL Server switches to another thread that contains requests from another client which makes changesto the data in the previous select statements. This will make my updates bad, since they rely on data (from the select statements)that has been modified.
I guess I'm curious what I would need to do to lock the records in the select statements until after my update statements are completed. Thanks in advance for any advice!
EverettBump
No comments:
Post a Comment