May 24, 2012

sp_MSreleasemakegenerationapplock (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_MSreleasemakegenerationapplock()

MetaData:

   
create procedure sys.sp_MSreleasemakegenerationapplock
as
set nocount on

declare @retcode smallint
declare @lock_resource nvarchar(255)
declare @DbPrincipal sysname

-- Security check
exec @retcode = sys.sp_MSrepl_PAL_rolecheck
if (@retcode <> 0) or (@@error <> 0)
return 1

select @retcode = 0
select @lock_resource = N'MSinternal_makegeneration_inprogress' +
convert(nvarchar(11), db_id())

if exists (select * from sys.database_principals where name=N'MSmerge_PAL_role' and type = 'R')
select @DbPrincipal = N'MSmerge_PAL_role'
else
select @DbPrincipal = N'db_owner'

exec @retcode = sp_releaseapplock @Resource = @lock_resource, @LockOwner = N'Session', @DbPrincipal = @DbPrincipal
if @@error <> 0 or @retcode < 0
return (1)
else
return (0)

No comments:

Post a Comment

Total Pageviews