Collapse the table of content
Expand the table of content


SQL Server 2000

Requires Service Pack 1 or later. Scripts the custom INSERT, UPDATE, and DELETE procedures for all table articles in a publication in which the auto-generate custom procedure schema option is enabled. sp_scriptpublicationcustomprocs is particularly useful for setting up subscriptions for which the snapshot is applied manually.


sp_scriptpublicationcustomprocs [@publication]= 'publication_name'


[@publication] = 'publication_name

Is the name of the publication. publication_name is sysname with no default.

Return Code Values

0 (success) or 1 (failure)

Result Sets

Returns a result set that consists of a single nvarchar(4000) column. The result set forms the complete CREATE PROCEDURE statement necessary to create the custom stored procedure.


Custom procedures are not scripted for articles without the auto-generate custom procedure (0x2) schema option.


Execute permission is granted to public; a procedural security check is performed inside this stored procedure to restrict access to members of the sysadmin fixed server role and db_owner fixed database role in current database.


This example generates a script of the custom stored procedures in a publication named Northwind.

EXEC Northwind.dbo.sp_scriptpublicationcustomprocs 
@publication = N'Northwind'
© 2015 Microsoft