Are data rows locked when they are edited in SQL Server Management Studio 2008?

When I right-click on a table in SQL Server Management Studio and select "Edit top 200 rows", at what point, if ever, will the data I'm looking for be locked?

One of my colleagues stated that when viewing data in this way, rows of data can be locked (I think when he said if you put the cursor on the row and start editing the data).

Is this the only time that data can be locked in this context?

+5
source share
3 answers

. script ( ):

create table Tx (
    ID int not null,
    Val1 varchar(20) not null
)
go
insert into Tx (ID,Val1)
select 1,'abc'
go
set nocount on
while 1=1
begin
    update Tx set Val1 = CASE WHEN Val1='abc' then 'def' else 'abc' end
    RAISERROR('Updated',10,1) WITH NOWAIT
    WAITFOR DELAY '00:00:05'
end

5 Val1 Updated ( , " " ).

SSMS Tx . , script .

+5

GUI SSMS.

, /, / .. , , .

+2

It may be blocked. In the edit panel, try pasting a row and violating the primary key constraint. A pop-up message appears with an error dialog box. Now the table will be locked while you read this message. If you leave without confirming the message, this table will be locked indefinitely. I just confirmed this with both SSMS 2008R2 and SSMS 2012.

+1
source

All Articles