April 18, 2012

sp_dropanonymoussubscription (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_dropanonymoussubscription(int @agent_id
, int @type)

MetaData:

 CREATE PROCEDURE sys.sp_dropanonymoussubscription  
(
@agent_id int,
@type int -- 1 tran sub, 2 merge sub
)
as
begin
declare @retcode int
--
-- security check
-- only db_owner can execute this
--
if (is_member ('db_owner') != 1)
begin
raiserror(14260, 16, -1)
return (1)
end
if @type not in (1,2)
begin
raiserror(20587, 16, -1, '@type', 'sp_dropanonymoussubscription')
return (1)
end
-- If tran
if @type = 1
begin
if not exists (select * from MSdistribution_agents where
id = @agent_id and
subscriber_name is not null)
begin
RAISERROR (14055, 11, -1)
return(1)
end
exec @retcode = sys.sp_MSdrop_distribution_agentid @agent_id
if @retcode <> 0 or @@error <> 0
return 1
end
else
begin
if not exists (select * from dbo.MSmerge_agents where
id = @agent_id and
anonymous_subid is not null)
begin
RAISERROR (14055, 11, -1)
return(1)
end
exec @retcode = sys.sp_MSdrop_merge_agentid @agent_id
if @retcode <> 0 or @@error <> 0
return 1
end
end

No comments:

Post a Comment

Total Pageviews