Re: Locking...
- From: "Roger Wolter[MSFT]" <rwolter@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Nov 2006 12:59:07 -0800
Not sure exactly what you're looking for but the lock hints are explained
here:
http://msdn2.microsoft.com/en-us/library/ms187373.aspx
I think you should also look at the READPAST hint for your application.
In SQL 2005 you can do an update top 1 with output that would be quite a bit
more efficient.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Rogers" <naissani@xxxxxxxxxxx> wrote in message
news:%23ncRMxjDHHA.4396@xxxxxxxxxxxxxxxxxxxxxxx
Can any one give me any URL where I can find the locking Hint with
example.
I have a two query in one my stored procedure and in the that its
returning session ID to users like.
Set @SessionID = (Select TOP 1 SessionID from Session)
UPDATE Session
Set UsedYN = 1
where SessionID = @SessionID
Select SessionID from Session
What my concern is if any user call this stored procedure then it wont
return the same session id to more than one user. What if I can rewrite
the same query like that .
set begin transaction
Set @SessionID = (Select TOP 1 SessionID from Session (UPDLOCK) Where
UserYN = 0)
UPDATE Session
Set UsedYN = 1
where SessionID = @SessionID
Commit Transaction
Can any guide gave his comments regarding above queries and I want to
clear my locking concepts, I would really appreciate if any one send me
the URL that contains this sort of example and locking HINT.
Thanks in advance.
.
- References:
- Locking...
- From: Rogers
- Locking...
- Prev by Date: Re: Locking...
- Next by Date: Re: Alert in Email !!!
- Previous by thread: Re: Locking...
- Next by thread: Re: Locking...
- Index(es):
Loading