don't work. it locks.
and I get :
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'a1'.
Clause: Update a1 Set a='3' From a with (rowlock) where a='1'
but: Update a1 Set a='3' From a as a1 with (rowlock) where a='1';
is ok, is that what You mean? but this locks.
And there...
And how force sqlserver to use rowlock?
both sessions have autocommit off, and both have said commit before next scenarion
SESSION 1:
Sql> update a with (rowlock) set a='3' where a='1';
Processed: 1
Sql>
SESSION 2:
Sql> update a with (rowlock) set a='4' where a='2';
# and this session...
this example is perhaps better:
create table a(a varchar(2));
insert into a values('1');
insert into a values('2');
commit;
SESSION 1:
update a set a='3' where a='1';
Processed: 1
SESSION 2:
update a set a='4' where a='2';
Processed: 1
SESSION 3:
update a set a='4' where a='1';
# this...
Don't help.
because I don't neet those reads, those are there just to show what is in database.
sessions locks even if I say just:
create table a(a varchar(2));
insert into a values('1');
insert into a values('2');
commit;
SESSION 1:
update a set a='3' where a='1';
Processed: 1
SESSION 2...
is it possibly to execute next scenarion with sqlserver?
and if it is possible, how?
I have tried "Read commited snapshot", nolock, readpast and all kind of combinations, but nothing seems to work properly.
both sessions runs same time with separed programs and both session have "autocommit...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.