May 10, 2004 at 4:23 am
Hello everyone!
Anyone knows how to determine if I (I am 'inside' an sql server connection. I.e @@SPID = me) have a certain application lock (in the current DB) and which mode it is in?
My AppLock string is 'HelloWorld'.
If anyone would help me crack that nut I would be happy 🙂
Regards, Hanslindgren!
P.S It'a a pity that it is not possible to modify the Subject when you are editing...
May 11, 2004 at 7:04 am
I don't know anyway to definite identify the Application lock. But, I normally select from sysprocesses table and pay special attention to 'waittype' column. When the value in this column is not 0x000, it seems have some kind of locking occurred on the APP level.
May 11, 2004 at 8:01 am
Thanx but I meant Application Locks. Not if there is a Block from an Application Lock.
Ex:
DECLARE @result INT
DECLARE @myspid INT ; SET @myspid = (SELECT @@SPID)
EXEC @result = sp_getapplock
@Resource = 'HelloWorld',
@LockMode = 'Exclusive' ,
@LockOwner = 'Session' ,
@LockTimeout = 0
SELECT @result -- 0 or 1 means we got the lock
EXEC sp_lock @spid1 = @myspid
-----------
0
(1 row(s) affected)
spid dbid ObjId IndId Type Resource Mode Status
------ ------ ----------- ------ ---- ---------------- -------- ------
52 2 0 0 APP Hella54e2269 X GRANT
52 1 1558296611 0 TAB IS GRANT
I would like to be sure that I am the owner of the Exclusive Application lock that is put on 'HelloWorld' (IF any has been put on 'HelloWorld') in the current DB. (The extension would be to determine which spid currently is in control of a certain application lock...)
Regards, Hanslindgren!
Edit: fixing my english
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply