Sai
2003-12-12 17:10:50 UTC
I want to have an exclusive lock at row level for a sql
statement in a transaction,to accomplish this
I used (rowlock xlock) lock hint on SELECT
statement,surprisingly it is not working for some of the
tables
is there any restriction using this hint??
Here is an example to reproduce the above probelm
1) LOCK hint is working fine with this table "employee"
from PUBS
QA --Query Analyzer
a)QA 1
begin tran
select * from employee(rowlock xlock) where emp_id = 'F-
C16315M'
b)QA 2
select * from employee where emp_id = 'F-C16315M'
So QA2 will not get data as it was expected because of the
LOCK hint from QA1,so this works
fine.
2) Lock hint Not working with this table "authors" from
PUBS
a)QA 1
begin tran
select * from authors(rowlock xlock) where emp_id = 'F-
C16315M'
b)QA 2
select * from authors where emp_id = 'F-C16315M'
Here I am able to get that data in QA2 ,so lock hint is
not working
Any one has idea????
Thanks
Sai
statement in a transaction,to accomplish this
I used (rowlock xlock) lock hint on SELECT
statement,surprisingly it is not working for some of the
tables
is there any restriction using this hint??
Here is an example to reproduce the above probelm
1) LOCK hint is working fine with this table "employee"
from PUBS
QA --Query Analyzer
a)QA 1
begin tran
select * from employee(rowlock xlock) where emp_id = 'F-
C16315M'
b)QA 2
select * from employee where emp_id = 'F-C16315M'
So QA2 will not get data as it was expected because of the
LOCK hint from QA1,so this works
fine.
2) Lock hint Not working with this table "authors" from
PUBS
a)QA 1
begin tran
select * from authors(rowlock xlock) where emp_id = 'F-
C16315M'
b)QA 2
select * from authors where emp_id = 'F-C16315M'
Here I am able to get that data in QA2 ,so lock hint is
not working
Any one has idea????
Thanks
Sai