Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 2.71 KB

sp-addmergepartition-transact-sql.md

File metadata and controls

70 lines (48 loc) · 2.71 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_addmergepartition (Transact-SQL)
Creates a dynamically filtered partition for a subscription that is filtered.
markingmyname
maghan
randolphwest
11/23/2023
sql
replication
reference
sp_addmergepartition
sp_addmergepartition_TSQL
sp_addmergepartition
TSQL

sp_addmergepartition (Transact-SQL)

[!INCLUDE SQL Server SQL MI]

Creates a dynamically filtered partition for a subscription, filtered by the values of HOST_NAME or SUSER_SNAME at the Subscriber. This stored procedure is executed at the Publisher on the database that is being published, and is used to manually generate partitions.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_addmergepartition
    [ @publication = ] N'publication'
    [ , [ @suser_sname = ] N'suser_sname' ]
    [ , [ @host_name = ] N'host_name' ]
[ ; ]

Arguments

[ @publication = ] N'publication'

The merge publication on which the partition is being created. @publication is sysname, with no default. If @suser_sname is specified, the value of hostname must be NULL.

[ @suser_sname = ] N'suser_sname'

The value used when creating the partition for a subscription, filtered by the value of the SUSER_SNAME function at the Subscriber. @suser_sname is sysname, with no default.

[ @host_name = ] N'host_name'

The value used when creating the partition for a subscription, filtered by the value of the HOST_NAME function at the Subscriber. @host_name is sysname, with no default.

Return code values

0 (success) or 1 (failure).

Remarks

sp_addmergepartition is used in merge replication.

Examples

:::code language="sql" source="../replication/codesnippet/tsql/sp-addmergepartition-tra_1.sql":::

Permissions

Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_addmergepartition.

Related content