May 21, 2012

sp_MSlock_distribution_agent (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_MSlock_distribution_agent(int @id
, int @mode)

MetaData:

 CREATE PROCEDURE sys.sp_MSlock_distribution_agent   
(
@id int,
@mode int = 1 -- 0: shared 1: exclusive
)
AS
begin
SET NOCOUNT ON
DECLARE @active tinyint
declare @count int
--
-- security check
-- only db_owner can execute this
--
if (is_member ('db_owner') != 1)
begin
raiserror(14260, 16, -1)
return (1)
end
select @active = 2
if @mode = 0
select @count = count(*) from dbo.MSsubscriptions with (ROWLOCK REPEATABLEREAD) where agent_id = @id and status = @active
else
select @count = count(*) from dbo.MSsubscriptions with (ROWLOCK UPDLOCK) where agent_id = @id and status = @active
end

No comments:

Post a Comment

Total Pageviews