May 24, 2012

sp_MSreinit_subscription (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_MSreinit_subscription(nvarchar @publisher_name
, nvarchar @publisher_db
, nvarchar @publication
, nvarchar @subscriber_name
, nvarchar @subscriber_db)

MetaData:

 CREATE PROCEDURE sys.sp_MSreinit_subscription  
(
@publisher_name sysname,
@publisher_db sysname,
@publication sysname = 'all',
@subscriber_name sysname = 'all',
@subscriber_db sysname = 'all'
)
as
begin
set nocount on
declare @proc nvarchar(2048)
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 @publisher_name IS NULL or NOT EXISTS (select * from master.dbo.sysservers as ss, dbo.MSpublications as msp
where lower(ss.srvname) = lower(@publisher_name) and msp.publisher_id = ss.srvid)
begin
return (1)
end

if @publisher_db IS NULL
select @publisher_db = ''

select @proc = quotename(ltrim(rtrim(@publisher_name))) + '.' + quotename(@publisher_db) + '.dbo.sp_reinitsubscription '
exec @retcode = @proc @publication, 'all', @subscriber_name, @subscriber_db

return (@retcode)
end

No comments:

Post a Comment

Total Pageviews