May 24, 2012

sp_MSrefresh_anonymous (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_MSrefresh_anonymous(nvarchar @publication
, nvarchar @publisher
, nvarchar @publisher_db)

MetaData:

 CREATE PROCEDURE sys.sp_MSrefresh_anonymous   
(
@publication sysname,
@publisher sysname,
@publisher_db sysname
)
AS
begin
declare @retcode int
declare @publisher_id int
declare @success int
declare @agent_id int

--
-- security check
-- only db_owner can execute this
--
if (is_member ('db_owner') != 1)
begin
raiserror(14260, 16, -1)
return (1)
end

SELECT @publisher_id = NULL
SELECT @publisher_id = srvid FROM master.dbo.sysservers WHERE UPPER(@publisher) = UPPER(srvname)
IF @publisher_id IS NULL
BEGIN
RAISERROR(21169, 16, -1, @publisher, @@SERVERNAME, @publisher)
return (1)
END
select @success = 2 -- agent history status

select @agent_id = id from dbo.MSmerge_agents where
anonymous_subid is not NULL and -- touch anonymous only
publication like @publication and
publisher_id=@publisher_id and
publisher_db=@publisher_db

update TOP(1) dbo.MSmerge_sessions set end_time=getdate() where agent_id=@agent_id and runstatus=@success
if @@ERROR<>0
return (1)
end

No comments:

Post a Comment

Total Pageviews