Can two users connected to a DB and update the same row of a table simultaneously in SQL server? -
can 2 users connected db , update same row of table simultaneously in sql server?
for example, user , user b logged in same db simultaneously , begin new transactions , update weekly rent simultaneously.
the original weekly rent $300/pw.
user a: update rent set weeklyrent = weeklyrent* 1.1 address ='121 green'
user b: update rent set weeklyrent = weeklyrent* 1.2 address ='121 green'
then user issues commit statement. user b issues commit statement.
what final rent price? $330 or $360 or $300? i've researched , seems data won't change because of 'deadlock'. please correct me if i'm wrong. in advance~
sql server lock table/row/page ensure able update. talking milliseconds in cases impossible them "simultaneously" updating same record. sure use transaction , limit connection times because record locked until transaction ends.
Comments
Post a Comment