Where is the lock: on a row or a table?

G

Guest

Hi,

I would like to ask, how SQ Server Express manage the table access:

I have two processes. What happen if one process is writing data into
table,and another process is updating data from this table at the same time.

Will be the second process allowed to access this table for reading ? Or it
can access this table, but can not access (read) the row which is beeing
updated?

Thanks,
Lubomir
 
W

William \(Bill\) Vaughn

Operations executed by any serious DBMS engine serialize these operations
(even when running with parallel threads). This means the tasks are handled
one-at-a-time. What you're describing is concurrency. All of the books on
data access discuss concurrency and the basic strategies to manage by
correct design (most importantly) and application coding.
When two users try to change the same row, yes, the row (and possibly the
page or table) can be locked for a time. The time depends on a number of
factors that means that the server waits until the lock is released
(automatically) before reattempting the change.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
G

Guest

So if I understand it right, if one application writes data to the table, SQL
Server will not allowe to another application (process) to read data from
this table if there would be a possibility thta datawould be only partially
updated while reading.

This will be achieved automatically? Or the Updating must be done within a
transaction?

Thanks,

Lubomir
 
W

William \(Bill\) Vaughn

There are ways to manage locking, but without invoking special features,
updates are completed (on a row) completely or not at all.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
C

Cor Ligthert [MVP]

Lubomir,
So if I understand it right, if one application writes data to the table,
SQL
Server will not allowe to another application (process) to read data from
this table if there would be a possibility thta datawould be only
partially
updated while reading.
From what from Bill's text did you understand that. I did not read it in his
text.

(I saw something which was very conditional)

It is at present more normal to check afterwards if the data is changed
while it was at the clients side.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top