Defining Articles

A published table is called an article. You have a number of options for controlling the way a table is published. An article can be the entire table or a subset of columns and/or rows from the table.

For each article, you can set the article name, article description, and destination table name; exclude rows and columns from those published (horizontal and vertical partitioning); customize the synchronization schema script; and customize the data replication mechanism. You accomplish these tasks by using the Manage Article dialog box.

    To define an article
  1. While creating a publication, from the Edit Publications dialog box, select the Article tab; from the Articles in Publication list, select an article; and then choose the Edit button.

    For information about how to access the Edit Publications dialog box, see Creating Publications, earlier in this chapter.

    The Manage Article dialog box appears.

  2. To change the default name supplied for the article, type a new name in the Name box.
  3. To provide a description of this article, type it in the Description box.

    A description can be up to 255 characters.

  4. To change the default name supplied for the destination table, type a table name in the Destination Table box.
  5. To partition the article vertically or horizontally, select the Filters tab.
  6. To partition the article vertically¾so that only selected columns are replicated¾select the Replicate option box for each column to be replicated. Clear the Replicate option box for each column that will not be replicated.

    If you do not modify the default settings, all columns are replicated. You must replicate the primary key column.

  7. To partition the article horizontally¾so that only selected rows are replicated¾type a WHERE clause in the Restriction Clause box.

    For example, if you have published the authors table from the pubs database and are editing the authors article, you could replicate only those rows containing authors from California by typing:

    state = 'CA'
    
  8. To customize the data replication mechanism or the synchronization schema script, select the Scripts tab.

  9. Define the data replication mechanism.

    Usually, you will not change this from the default. The data replication mechanism determines the action SQL Server takes when the log reader process encounters transactions (INSERT, UPDATE, or DELETE) that are marked for replication in the transaction log of the publication database.

  10. To allow SQL Server to automatically create the initial table synchronization schema script for you, leave the Creation Script box blank.

    When you edit a new article, this box is empty. When you edit an existing article, this box contains the full path to the schema script in the distribution working directory. For example:

    \\TERRIER\C$\SQL60\REPLDATA\terrier_sales_receipts_charges.sch
    

    Schema scripts are automatically generated when a publication is created or modified (by choosing the Add or Modify button from the Edit Publications dialog box).

  11. To edit an existing schema creation script, choose Edit, edit the creation script in the Creation Script dialog box that appears, and then choose OK.

    The Manage Article dialog box returns.

  12. To generate a schema script now, choose the Generate button and complete the Auto-Generate Sync Scripts dialog box that appears.

    When the options are set, choose Auto-Generate. The initial table synchronization schema script is created. The Manage Article dialog box returns.

  13. To use a schema creation script that you have prepared manually, place that schema script in the distribution working directory, and then enter the full path and filename in the Creation Script box. For example:
    \\TERRIER\C$\SQL60\REPLDATA\terrier_sales_receipts_myschema.sch
    

    Note that you enter the full UNC path even if this is a combined publisher/distributor using its own local distribution working directory. Use the administrative share name (ending in "$") for the drive, rather than the drive letter.

  14. To specify custom filtering, select the Advanced button and complete the Manage Article-Advanced dialog box that appears.

    When the options are set, choose OK. The Manage Article dialog box returns.

  15. When the advanced article is defined, from the Manage Article dialog box, choose OK.

    The Edit Publications dialog box returns.

If you create an auto-generated script that does not support the creation of indexes, then the synchronization task will use fast bcp as the initial synchronization method if the Select Into/Bulk Copy option is set in the destination database.