Can following situation be done in other isolation level also.

hi,

     i have a situation i found this in a book

begin snapshot transaction

insert ( from one table  a to other table b) where transfered col =1

update ( from one table  a to other table b) where transfered col =1

delete ( from one table  a to other table b) where transfered col =1

update table a set transferedcol = 0 where transferedcol = 1

end snapshot transaction 

in this case if some one update the table a , it throws an error that table can not be updated in snapshot isolation level 

so what we have done is we are trape the error , rolling bak the transactin and starts the again.

this is working fine 

Q1) can it be done in any other isolatiion level.

any other solution will be help full.

yours sincerley.

March 21st, 2015 8:29am

You would not get that error with any other isolation level, because those types of conflicts are particular for snapshot isolation. But there are other concurrency errors you can encounter, and the most famous of them all is deadlock.

Free Windows Admin Tool Kit Click here and download it now
March 21st, 2015 9:07am

Q1) can it be done in any other isolatiion level.

It is common to implement optimistic concurrency in other transaction isolation levels using a rowversion column.  The rowversion column is checked in updates and delete WHERE clauses and an error raised of no rows were modified (because another session updated or deleted the row).  Without a rowversion column, all of the column values to be modified must be checked against the original values.

March 21st, 2015 12:38pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics