concurency
i have found this case of concurency during my study to database subject i try to test this case but there is no
result because i have only one computer,
user1:
insert into Sale(money) value (1000) run at 12:12:12 pm
set id = @@identity
insert into Transaction(Transaction_Id,Account) value (id,1000)
user2:
insert into Sale(money) value (1000) run at 12:12:12 pm
set id = @@identity
insert into Transaction(Transaction_Id,Account) value (id,1000)
Note :- Sale have two column (Sale_Id with identity property set to true and money)
and Transaction have two column (Transaction_Id,Account)
1-is it possible to occur, if it is occur does a primary key constraint violation occur and if a primary key constraint violation doesn't occur what is the
value of id into both user's application?
2-is it need to put insert statement inside
Transaction Block to Prevent the above case or database engin manage this case?
|