May 2, 2012

sp_MSactivateprocedureexecutionarticleobject (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_MSactivateprocedureexecutionarticleobject(nvarchar @qualified_procedure_execution_object_name
, bit @is_repl_serializable_only)

MetaData:

 --   
-- Name: sp_MSactivateprocedureexecutionarticleobject
--
-- Description: This procedure is called by the snapshot agent to activate
-- a single procedure execution article object.
--
-- Parameters: @qualified_procedure_execution_object_name
-- @is_repl_serializable_only
--
-- Notes: This procedure must be called within a user transaction or it will
-- result in a no-op.
--
-- Security: Public interface object, will result in no-op if called by
-- non-db_owner or non-replication agent.
-- Requires Certificate signature for catalog access
--
create procedure sys.sp_MSactivateprocedureexecutionarticleobject (
@qualified_procedure_execution_object_name nvarchar(517),
@is_repl_serializable_only bit
)
as
begin
set nocount on

if @@trancount < 1 return 1

if sessionproperty('replication_agent') <> 1 return 1

if object_id(N'dbo.syspublications', 'U') is null return 1

declare @retcode int
, @is_execution_replicated bit
, @current_is_repl_serializable_only bit
, @object_id int
, @error int
set @retcode = 0

exec @retcode = sys.sp_MSreplcheck_publish
if @@error <> 0 or @retcode <> 0
return 1

set @object_id = object_id(@qualified_procedure_execution_object_name)
select @is_execution_replicated = is_execution_replicated
, @current_is_repl_serializable_only = is_repl_serializable_only
from sys.procedures
where object_id = @object_id

if @is_execution_replicated = 0 or
@current_is_repl_serializable_only = 0 and @is_repl_serializable_only = 1
begin
exec %%Object(MultiName = @qualified_procedure_execution_object_name).LockMatchID(ID = @object_id, Exclusive = 1, BindInternal = 0)
set @error = @@error if @error <> 0 begin raiserror(@error, 16, -1) return 1 end
exec %%Module(ID = @object_id).SetProcReplicated(Value = 1)
set @error = @@error if @error <> 0 begin raiserror(@error, 16, -1) return 1 end
if @is_repl_serializable_only = 1
begin
exec %%Module(ID = @object_id).SetProcReplSerialOnly(Value = 1)
set @error = @@error if @error <> 0 begin raiserror(@error, 16, -1) return 1 end
end
end

return 0
end

No comments:

Post a Comment

Total Pageviews