sp_addmergearticle (T-SQL)
Adds an article to an existing merge publication.
Syntax
sp_addmergearticle [@publication =] 'publication', [@article =] 'article',
[@source_object =] 'source_object'
[,[@type =] 'type']
[,[@description =] 'description']
[,[@column_tracking =] 'column_tracking'] [,[@status =] 'status']
[,[@pre_creation_cmd =] 'pre_creation_cmd']
[,[@creation_script =] 'creation_script']
[,[@schema_option =] schema_option]
[,[@subset_filterclause =] 'subset_filterclause']
[,[@article_resolver =] 'article_resolver']
[,[@resolver_info =] 'resolver_info']
[,[@source_owner =] 'source_owner']
Arguments
- [@publication =] 'publication'
- Is the name of the publication that contains the article. publication is sysname, with no default.
- [@article =] 'article'
- Is the name of the article. article is sysname, with no default. article must be local, conform to the rules for identifiers, and be a table. article cannot be a view or another database object.
- [@source_object =] 'source_object'
- Is the name of the source table from which to add the article. source_object is sysname, with no default.
- [@type =] 'type'
- Is the type of article. type is sysname, with a default of table. All other types are reserved for future use.
- [@description =] 'description'
- Is a description of the article. description is nvarchar(255), with a default of NULL.
- [@column_tracking =] 'column_tracking'
- Is the setting for column-level tracking. column_tracking is nvarchar(10), with a default of FALSE. true implements column tracking. false turns off column tracking. If the table is already published using merge replication, you must use the same column tracking value.
- [@status =] 'status'
- Is the status of the article. status is nvarchar(10), with a default of unsynced. If active, the initial processing script to publish the table is run. If unsynced, the initial processing script to publish the table is run at the next time the Snapshot Agent runs.
- [@pre_creation_cmd =] 'pre_creation_cmd'
- Is a precreation method. pre_creation_cmd is nvarchar(10), and can be one of these values.
Value |
Description |
none |
If the table already exists at the Subscriber, no action is taken. |
delete |
Issues a delete based on the WHERE clause in the subset filter. |
drop (default) |
Drops the table before re-creating it. |
truncate |
Same as delete, but deletes pages instead of rows. Does not take a WHERE clause, however. |
- [@creation_script =] 'creation_script'
- Is the optional precreation script for the article. creation_script is nvarchar(255), with a default of NULL.
- [@schema_option =] schema_option
- Is a bitmap of the schema generation option for the given article. schema_option is binary(8), and can be one of these values.
Value |
Description |
0x00 |
Disables scripting by the Snapshot Agent and uses the provided CreationScript. |
0x01 |
Generates the object creation (CREATE TABLE, CREATE PROCEDURE, and so on). |
0x10 |
Generates a corresponding clustered index. |
0x20 |
Converts user-defined data types to base data types. |
0x40 |
Generates corresponding nonclustered index(es). |
0x80 |
Includes declared referential integrity on the primary keys. |
0xf1 (default) |
Generates the CREATE TABLE, creates clustered indexes, creates nonclustered index(es), converts user-defined data types to base data types. |
0x01 |
Default for stored procedure articles. |
- [@subset_filterclause =] 'subset_filterclause'
- Is a WHERE clause specifying the horizontal filtering. subset_filterclause is of nvarchar(2000), with a default of an empty string.
- [@article_resolver =] 'article_resolver'
- Is the custom resolver for the article. article_resolver is varchar(255), with a default of NULL. If custom resolver, SQL Server uses the specified resolver instead of the system-supplied resolver. Use sp_enumcustomresolvers to enumerate the list of available custom resolvers.
- [@resolver_info =] 'resolver_info']
- Is the name of the stored procedure used as a custom resolver. resolver_info is sysname, with a default of NULL.
- [@source_owner =] 'source_owner']
- Is the name of the owner of the source_object. source_owner is sysname, with a default of NULL. If NULL, the current user is assumed to be the owner.
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_addmergearticle is used in merge replication.
By default, the priorities defined for the Subscriber are used in resolving conflicts.
Permissions
Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_addmergearticle.
See Also
(c) 1988-98 Microsoft Corporation. All Rights Reserved.