| title | sp_scriptpublicationcustomprocs (Transact-SQL) | ||
|---|---|---|---|
| description | Scripts the custom INSERT, UPDATE, and DELETE procedures for all table articles in a publication in which the autogenerate custom procedure schema option is enabled. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | replication | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server SQL MI]
Scripts the custom INSERT, UPDATE, and DELETE procedures for all table articles in a publication in which the autogenerate custom procedure schema option is enabled. sp_scriptpublicationcustomprocs can be useful for setting up subscriptions for which the snapshot is applied manually.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_scriptpublicationcustomprocs
[ @publication = ] N'publication'
[ , [ @publisher = ] N'publisher' ]
[ , [ @usesqlclr = ] usesqlclr ]
[ ; ]
The name of the publication. @publication is sysname, with no default.
The name of the publisher. @publisher is sysname, with a default of NULL.
[!INCLUDE ssinternalonly-md]
0 (success) or 1 (failure).
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 aren't scripted for articles without the autogenerated custom procedure (0x2) schema option.
The following procedures are used by sp_scriptpublicationcustomprocs to create procedures the Subscriber, and shouldn't be executed directly:
sp_script_reconciliation_delprocsp_script_reconciliation_insprocsp_script_reconciliation_vdelprocsp_script_reconciliation_xdelprocsp_scriptdelprocsp_scriptinsprocsp_scriptmappedupdprocsp_scriptupdprocsp_scriptvdelprocsp_scriptvupdprocsp_scriptxdelprocsp_scriptxupdproc
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.