Critical Section In Query SQL server StoreProceature

Viewed 14

I have a store procedure and I want to run this storeprocedure one time at the same time. In the other hand Like lock variable in c# programing. Can anyone Help me?

1 Answers

for this situation you can use 2 solution for your critical section and the block you want to only one time a time

First use SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

For example

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
begin Tran
your Query
Commit Tran

Second Use DeadLock priority normal

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    begin Tran
    your Query
    Commit Tran
Related