Where does APPLOCK_TEST live?

I am looking to perform an APPLOCK_TEST within my .NET program, so I was wondering, what it is and where exactly does it live. By being in all upper case, I suspect it is a function, but I cannot find it. If it is a function then I will have to make an ExecuteScalar call. I don't think it is a stored procedure, so I cannot code calling it like one.
more ▼

asked Nov 18, 2010 at 04:44 PM in Default

anthonyk gravatar image

78 4 4 6

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
sp_getapplock and sp_releaseapplock are stored procedures. APPLOCK_TEST should be referenced via a SQL SELECT in a string or placed in a stored proc. eg SELECT APPLOCK_TEST('public', 'yourresource', 'Exclusive', 'Transaction') Preferably in a stored proc because you will have to wrap this in a transaction if the lock_owner is set as Transaction per the example. APPLOCK_TEST is a built-in function so there is nothing to view. You can find the lock info in master.sys.syslockinfo where rsc_type=10
more ▼

answered Nov 18, 2010 at 07:36 PM

Scot Hauder gravatar image

Scot Hauder
6.1k 13 15 18

Scot congrats for 3K!
Nov 18, 2010 at 08:39 PM Cyborg
Thanks, and you on 4K
Nov 18, 2010 at 08:42 PM Scot Hauder
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Nov 18, 2010 at 04:44 PM

Seen: 1330 times

Last Updated: Nov 18, 2010 at 04:44 PM