May 10, 2012

sp_MSdrop_6x_publication (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_MSdrop_6x_publication(uniqueidentifier @job_id)

MetaData:

 create procedure sys.sp_MSdrop_6x_publication  
(
@job_id UNIQUEIDENTIFIER
)
as
begin
declare @publisher sysname
declare @publisher_db sysname
declare @publication sysname
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
--
-- security check
-- Has to be executed from distribution database
--
if (sys.fn_MSrepl_isdistdb (db_name()) != 1)
begin
raiserror(21482, 16, -1, 'sp_MSdrop_6x_publication', 'distribution')
return (1)
end
-- Get publication information
select @publisher = srvname, @publisher_db = publisher_db, @publication = publication from
MSsnapshot_agents, master.dbo.sysservers where
job_id = @job_id and
srvid = publisher_id

-- Remove the publication and snapshot agent
exec @retcode = sys.sp_MSdrop_publication
@publisher = @publisher,
@publisher_db = @publisher_db,
@publication = @publication
if @@ERROR <> 0 or @retcode <> 0
return 1
end

No comments:

Post a Comment

Total Pageviews