Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize


SQL Server 2000

Releases a lock on an application resource.


sp_releaseapplock [ @Resource = ] 'resource_name'
    [ , [ @LockOwner = ] 'lock_owner' ]


[@Resource =] 'resource_name'

Is the lock resource name specified by the client application when the lock was requested. resource name is nvarchar(255), with no default.

[@LockOwner =] 'lock_owner'

Is the lock owner and must match the lock_owner value specified when the lock was requested. lock_owner is nvarchar(32), and can be Transaction (the default) or Session.

Return Code Values

>= 0 (success) or < 0 (failure)

Value Result
0 Lock was successfully released.
-999 Parameter validation or other call error.


If an application calls sp_getapplock multiple times on the same lock resource, sp_releaseapplock must be called the same number of times to release the lock.

When the server shuts down for any reason, the locks are released.


Execute permissions default to the public role.


This example releases the lock associated with the current transaction on the resource Form1 in the Northwind database. 

USE Northwind
EXEC sp_releaseapplock @Resource = 'Form1'

See Also


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft