June 8, 2012

sp_scriptpublicationcustomprocs (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


sys.sp_scriptpublicationcustomprocs(nvarchar @publication
, nvarchar @publisher
, bit @usesqlclr)


-- Name: sp_scriptpublicationcustomprocs
-- Description: This is a utility procedure for scripting out the
-- article "custom" ins/upd/del procedures for all
-- table articles in a publication with the auto-generate custom
-- procedure schema option enabled. This is particularly useful
-- and in fact specifically designed for setting up no-sync
-- subscriptions.
-- Notes: 1) Reconciliation procedures for concurrent snapshot will
-- not be scripted by this procedure. It does not really make
-- sense to have concurrent snapshots for no-sync subscriptions.
-- 2) Custom procedures will not be scripted out for articles
-- without the auto-generate custom procedure (0x2) schema_option.
-- Parameter: @publication sysname
-- Security: Execute permission is granted to public; procedural security
-- check is performed inside the procedure to restrict access
-- to sysadmins and db_owners of current database.
-- Example: exec Northwind.sys.sp_scriptpublicationcustomprocs @publication = N'Northwind'
create procedure sys.sp_scriptpublicationcustomprocs
@publication sysname,
@publisher sysname = NULL,
@usesqlclr bit = 1
DECLARE @cmd nvarchar(4000)
DECLARE @retcode int
DECLARE @publisher_type sysname

SET @retcode = 0

EXEC @retcode = sys.sp_MSrepl_getpublisherinfo @publisher = @publisher,
@rpcheader = @cmd OUTPUT,
@publisher_type = @publisher_type OUTPUT

IF @retcode <> 0
RETURN (@retcode)

-- Add sp
set @cmd = @cmd + N'sys.sp_MSrepl_scriptpublicationcustomprocs'

EXEC @retcode = @cmd

RETURN (@retcode)

raiserror('Creating procedure sp_MSrepl_scriptpublicationcustomprocs',0,-1) with nowait

No comments:

Post a Comment

Total Pageviews