Can two users connected to a DB and update the same row of a table simultaneously in SQL server?

user3601310

Can two users connected to a DB and update the same row of a table simultaneously in SQL server?

For example, user A and user B are logged in to a same DB simultaneously and begin new transactions and then update a weekly rent simultaneously.

The original weekly rent is $300/pw.

User A: Update RENT Set WeeklyRent = WeeklyRent* 1.1 where Address ='121 Green'

User B: Update RENT Set WeeklyRent = WeeklyRent* 1.2 where Address ='121 Green'

Then User A issues a Commit statement. Then User B issues a Commit statement.

What will be the final rent price? Will this be $330 or $360 or $300? I've researched it and it seems like the data won't change because of 'deadlock'. Please correct me if I'm wrong. Thanks in advance~

Russell Bevan

SQL Server will lock the table/row/page to ensure that you will be able to do the update. However we are talking milliseconds in most cases so it is almost impossible for them to be "simultaneously" updating the same record. Just be sure to always use a transaction and limit connection times because the record will be locked until the transaction ends.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SQL server: Can concurrent threads update same row?

From Dev

Can two users simultaneously share one pc

From Dev

What's the best practice to update a specific db-table-row-column simultaneously?

From Dev

Update a local db table from remote SQL Server db table

From Dev

Can multiple users insert into a server database simultaneously?

From Dev

SQL Server trigger to update the same table

From Dev

How can I join a table from two keys referencing same table with SQL Server?

From Dev

How can I Update two fields in same table with different conditions (SQL)?

From Dev

SQL Comparing Two Columns in same table and update in another table

From Dev

Can two sql queries affect the same row at the same time

From Dev

Can two Eloquent ORM instances manipulate same DB table

From Dev

SQL Server trigger update insert between table in different DB

From Dev

Can multiple people update the same record in SQL Server at the same time?

From Dev

SQL Query to compare two most recently modified row of the same table

From Dev

Same db table for two models

From Dev

Update row with select on same table

From Dev

Update a table with the value of the same row

From Dev

Update Each Exisiting Row of SQL Server Table Using Loop

From Dev

Can two threads interact simultaneously with two different sockets on the same port?

From Dev

SQL Server : copy row and Insert into to the same table but with a different ID

From Dev

SQL Server : copy row and Insert into to the same table but with a different ID

From Dev

Select corresponding to row from the same table SQL Server

From Dev

Update a table such that multiple users get a new row

From Dev

Fetch single row from two rows of a table with join in SQL Server

From Dev

SQL Server : update rows based other rows in the same table

From Dev

SQL Server - Update column from data in the same table

From Dev

Update/insert Trigger triggering the same table in SQL Server

From Dev

Make a copy of a table in the same database of SQL Server 2008 and then update the contents

From Dev

sql merge two rows into one, same table. (update 1st with 2nd row data, then delete 2nd row)

Related Related

  1. 1

    SQL server: Can concurrent threads update same row?

  2. 2

    Can two users simultaneously share one pc

  3. 3

    What's the best practice to update a specific db-table-row-column simultaneously?

  4. 4

    Update a local db table from remote SQL Server db table

  5. 5

    Can multiple users insert into a server database simultaneously?

  6. 6

    SQL Server trigger to update the same table

  7. 7

    How can I join a table from two keys referencing same table with SQL Server?

  8. 8

    How can I Update two fields in same table with different conditions (SQL)?

  9. 9

    SQL Comparing Two Columns in same table and update in another table

  10. 10

    Can two sql queries affect the same row at the same time

  11. 11

    Can two Eloquent ORM instances manipulate same DB table

  12. 12

    SQL Server trigger update insert between table in different DB

  13. 13

    Can multiple people update the same record in SQL Server at the same time?

  14. 14

    SQL Query to compare two most recently modified row of the same table

  15. 15

    Same db table for two models

  16. 16

    Update row with select on same table

  17. 17

    Update a table with the value of the same row

  18. 18

    Update Each Exisiting Row of SQL Server Table Using Loop

  19. 19

    Can two threads interact simultaneously with two different sockets on the same port?

  20. 20

    SQL Server : copy row and Insert into to the same table but with a different ID

  21. 21

    SQL Server : copy row and Insert into to the same table but with a different ID

  22. 22

    Select corresponding to row from the same table SQL Server

  23. 23

    Update a table such that multiple users get a new row

  24. 24

    Fetch single row from two rows of a table with join in SQL Server

  25. 25

    SQL Server : update rows based other rows in the same table

  26. 26

    SQL Server - Update column from data in the same table

  27. 27

    Update/insert Trigger triggering the same table in SQL Server

  28. 28

    Make a copy of a table in the same database of SQL Server 2008 and then update the contents

  29. 29

    sql merge two rows into one, same table. (update 1st with 2nd row data, then delete 2nd row)

HotTag

Archive