Udostępnij za pośrednictwem


How to: Specify Article Types (Replication Transact-SQL Programming)

The default article types for replication are table articles, but you can publish other database objects as articles, including views, stored procedures, user-defined functions, and stored procedure execution. You can use replication stored procedures to specify an article type programmatically when you define an article. The procedures that you use depend on the type of replication and article type.

Note

The schema-only designation when defining table, view, and stored procedure articles indicates that only the object definition is replicated.

To publish a table article in a transactional or snapshot publication

  1. At the Publisher on the publication database, execute sp_addarticle. Specify one of the following values for @type to define the type of article:

    This defines a new article for the publication. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

  2. For logbased manualboth and logbased manualfilter articles, execute sp_articlefilter to generate the filtering stored procedure for a horizontally filtered article. For more information, see How to: Define and Modify a Static Row Filter (Replication Transact-SQL Programming).

  3. For logbased manualboth, logbased manualview, and logbased manualfilter articles, execute sp_articleview to generate the view that defines the vertically filtered article. For more information, see How to: Define and Modify a Column Filter (Replication Transact-SQL Programming).

To publish a view or indexed view article in a transactional or snapshot publication

  1. At the Publisher on the publication database, execute sp_addarticle. Specify one of the following values for @type to define the type of article:

    This defines a new article for the publication. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

  2. For logbased manualboth and logbased manualfilter articles, execute sp_articlefilter to generate the filtering stored procedure for a horizontally filtered article. For more information, see How to: Define and Modify a Static Row Filter (Replication Transact-SQL Programming).

  3. For logbased manualboth, logbased manualview, and logbased manualfilter articles, execute sp_articleview to generate the view that defines the vertically filtered article. For more information, see How to: Define and Modify a Column Filter (Replication Transact-SQL Programming).

To publish a stored procedure, stored procedure execution, or user-defined function article in a transactional or snapshot publication

  1. At the Publisher on the publication database, execute sp_addarticle. Specify one of the following values for @type to define the type of article:

    This defines a new article for the publication. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

To publish a table or view article in a merge publication

  1. At the Publisher on the publication database, execute sp_addmergearticle. Specify one of the following values for @type to define the type of article:

    • table - a table article.
    • indexed view schema only - a schema-only indexed view article.
    • view schema only - a schema-only view article.

    This defines a new article for the publication. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

To publish a stored procedure or user-defined function article in a merge publication

  1. At the Publisher on the publication database, execute sp_addmergearticle. Specify one of the following values for @type to define the type of article:

    • func schema only - a schema-only user-defined function article.
    • proc schema only - a schema-only stored procedure article.

    This defines a new article for the publication. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

See Also

Concepts

Programming Replication Using System Stored Procedures

Other Resources

Publishing Data and Database Objects

Help and Information

Getting SQL Server 2005 Assistance