June 4, 2012

sp_MSupdate_subscriber_tracer_history (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_MSupdate_subscriber_tracer_history(int @parent_tracer_id
, int @agent_id)

MetaData:

 --   
-- Name:
-- sp_MSupdate_subscriber_tracer_history
--
-- Description:
-- This procedure will update the MStracer_history row's subscriber_commit
-- time to getdate().
--
-- Parameters:
-- @parent_tracer_id int tracer id of the parent
-- @subscriber sysname subscriber server name
-- @subscriber_db sysname subscriber database
--
-- Returns:
-- 0 - succeeded
-- 1 - failed
--
-- Result:
-- None
--
-- Security:
-- Sysadmin/dbo/pal (run by distribution agent)
--
create procedure sys.sp_MSupdate_subscriber_tracer_history
(
@parent_tracer_id int,
@agent_id int
)
as
begin
set nocount on

declare @retcode int,
@current_date datetime

select @current_date = getdate()

-- security check
exec @retcode = sys.sp_MScheck_pull_access @agent_id = @agent_id, @agent_type = 0
if @@error <> 0 or @retcode <> 0
begin
return 1
end

begin transaction tr_sp_MSupd_sub_tracer_hist
save transaction tr_sp_MSupd_sub_tracer_hist

-- here we will update the subscriber commit time
-- if the tracer history row no longer exists then
-- we will exit with no error because this may happen
-- if cleanup comes bye and removes the history row
update MStracer_history
set subscriber_commit = @current_date
where parent_tracer_id = @parent_tracer_id
and agent_id = @agent_id
if @@error <> 0
goto Err_Handler

commit transaction tr_sp_MSupd_sub_tracer_hist
return 0

Err_Handler:
rollback transaction tr_sp_MSupd_sub_tracer_hist
commit transaction

return 1
end

No comments:

Post a Comment

Total Pageviews