October 12, 2016 at 6:09 am
Hello There,
I have a procedure that is scheduled to run on sql server and some adhoc code that I am executing,
both is kind of same logic but diferent purpose, here the problem is
I have a table for get max(id) in the table then drives that id in the code (both places) here my code got updated each other
how to avoid updating same table/ reading same table when the other table is reading it? please advise
Thank you in advance
please help me
Milan
October 12, 2016 at 6:53 am
Instead of selecting the MAX(id) and then allocating it by insertin a row with that id, insert the row directly.
-- Gianluca Sartori
October 12, 2016 at 7:25 am
If this ID is a sequential integer, then use IDENTITY.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
October 12, 2016 at 3:22 pm
asita (10/12/2016)
Hello There,I have a procedure that is scheduled to run on sql server and some adhoc code that I am executing,
both is kind of same logic but diferent purpose, here the problem is
I have a table for get max(id) in the table then drives that id in the code (both places) here my code got updated each other
how to avoid updating same table/ reading same table when the other table is reading it? please advise
Thank you in advance
please help me
Milan
Use explicit transactions.
The table will be locked for any updates until the transaction is committed or rolled back.
_____________
Code for TallyGenerator
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply