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

Definition:

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

MetaData:

 --   
-- 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
)
AS
BEGIN
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 @publisher = UPPER(@publisher) COLLATE DATABASE_DEFAULT
set @cmd = @cmd + N'sys.sp_MSrepl_scriptpublicationcustomprocs'

EXEC @retcode = @cmd
@publication,
@publisher,
@publisher_type,
@usesqlclr

RETURN (@retcode)
END


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

No comments:

Post a Comment

Total Pageviews