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 |
|
|
|
[!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
sp_addmergepartition
[ @publication = ] N'publication'
[ , [ @suser_sname = ] N'suser_sname' ]
[ , [ @host_name = ] N'host_name' ]
[ ; ]
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
.
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.
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.
0
(success) or 1
(failure).
sp_addmergepartition
is used in merge replication.
:::code language="sql" source="../replication/codesnippet/tsql/sp-addmergepartition-tra_1.sql":::
Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_addmergepartition
.