June 7, 2012

sp_releaseapplock (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_releaseapplock(nvarchar @Resource
, varchar @LockOwner
, nvarchar @DbPrincipal)

MetaData:

 create procedure sys.sp_releaseapplock -- - 1999/04/14 00:00  
@Resource nvarchar (255) = NULL, -- Resource to unlock
@LockOwner varchar (32) = 'Transaction', -- Lock Owner - [D = Transaction]
@DbPrincipal sysname = N'public' -- DB principal to use for name space and permissions
as

declare @owner integer
declare @result integer
declare @dbid integer

select @owner =
CASE @LockOwner
When ('Transaction') Then 1
When ('Session') Then 3
Else -1
END

if @owner = -1
begin
raiserror(15625, -1, -1, @LockOwner, N'@LockOwner')
return (-999)
end

select @dbid = db_id ()

exec @result = sys.xp_userlock 1, @dbid, @DbPrincipal, @Resource, 0, @owner

return @result

No comments:

Post a Comment

Total Pageviews