How to synchronize multiple instances of a stored procedure executing at the same time in SQL Server 2012? -


overview: in scenario user uploads excel file needs written database, allocating each uploaded file batch_id batch_id written in last column of each row of table shown in these pictures file of user 1

enter image description here

with of batch_id column able segregate rows belong document.(for example: if batch_id=1 these 1000 rows belongs document 1)

problem: consider 2 users user1 , user2 executing stored procedure @ same time while stored procedure writing batch_id=1 in rows belong document1,at same time rows belonging document2 gets inserted causing conflict wether write batch_id=1 or batch_id=2 in rest of remaining rows.

imperfect solution: execute stored procedure on 1 document @ time,when done execute on document 2 let user wait until current execution finishes don't want happen.

you can execute single sp in parallel. not impact logic. please try.


Comments

Popular posts from this blog

php - isset function not working properly -

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -