Collection Contents Index Design overview Publication design for Adaptive Server Enterprise pdf/chap8.pdf

Data Replication with SQL Remote
   PART 2. Replication Design for SQL Remote
     CHAPTER 8. SQL Remote Design for Adaptive Server Enterprise       

Creating publications


In this section 

This section describes how to create simple publications consisting of whole tables, or of column-wise subsets of tables.

For Info     Simple publications are also discussed in the chapter A Tutorial for Adaptive Server Enterprise Users.

Top of page  Creating publications for Adaptive Server Enterprise using Sybase Central

In Sybase Central, you can add a publication to a database from within the SQL Remote folder. The SQL Remote folder is displayed inside a database container.

  To create a publication from Sybase Central:
  1. Click the Publications folder, which is inside the SQL Remote folder.

  2. Double-click Add Publication. The Publication Wizard is displayed.

  3. Follow the instructions in the Wizard.

For Info     For more information, see the Sybase Central online Help.

With Sybase Central, you do not need to know the SQL syntax in order to create publications. The remainder of this section discusses different kinds of publication that can be created. It describes the SQL syntax needed for these publications. However, each of the publications can also be created from Sybase Central.

Top of page  Creating whole-table articles

The simplest type of article is one that includes all the rows and columns of a database table.

  To create an article that includes all the rows and columns of a table:
  1. Mark the table for replication. You do this by executing the sp_add_remote_table procedure:

    sp_add_remote_table table-name
  2. Add the table to the publication. You do this by executing the sp_add_article procedure:

    sp_add_article publication-name, table-name

Example 

Top of page  Creating articles containing some of the columns in a table

To create an article that includes only some of the columns from a table, you need to list the columns that you wish to include, using sp_add_article_col. If no columns are listed, the article includes all columns of the table.

  To create an article that includes some of the columns and all the rows of a table:
  1. Mark the table for replication. You do this by executing the sp_add_remote_table procedure:

    sp_add_remote_table table-name
    go
  2. Add the table to the publication. You do this by executing the sp_add_article procedure:

    sp_add_article publication-name, table-name
    go

    The sp_add_article procedure adds a table to a publication. By default, all columns of the table are added to the publication. If you wish to add only some of the columns, you must use the sp_add_article_col procedure to specify which columns you wish to include.

  3. Add individual columns to the publication. You do this by executing the sp_add_article_col procedure for each column:

    sp_add_article_col publication-name, 
       table-name, 
       column-name
    go

Example 

Top of page  Creating articles containing some of the rows in a table

There are two ways of including only some of the rows from a table in an article:

Allowed clauses 

In SQL Remote for Adaptive Server Enterprise, the following limitations apply to each of these cases:

When to use WHERE and SUBSCRIBE BY 

You should use a subscription expression when different subscribers to a publication are to receive different rows from a table. The subscription expression is the most powerful method of partitioning tables.

Top of page  Creating an article using a WHERE clause

The WHERE clause is used to exclude a set of rows from all subscriptions to a publication.

  To create an article using a WHERE clause:
  1. If you have not already done so, mark the table for replication. You do this by executing the sp_add_remote_table procedure:

    sp_add_remote_table table_name
  2. Add the table to the publication. You do this by executing the sp_add_article procedure: Specify the column name corresponding to the WHERE column IS NOT NULL clause in the third argument to the procedure:

    sp_add_article publication_name, 
       table_name,
       column_name

    Do not specify IS NOT NULL; it is implicit. Specify the column name only.

  3. If you wish to include only a subset of the columns in the table, specify the columns using the sp_add_article_col procedure. You must include the column specified in your WHERE clause in the article.

Example 

Top of page  Creating an article using a subscription column

The subscription column is used when rows are to be shared among many remote databases.

  To create an article using a subscription column:
  1. If you have not already done so, mark the table for replication. You do this by executing the sp_add_remote_table procedure:

    sp_add_remote_table table_name

  2. Add the table to the publication. You do this by executing the sp_add_article procedure: Specify the column name you wish to use as a subscription expression in the fourth argument to the procedure:

    sp_add_article publication_name, table_name, NULL, column_name

    You must include the NULL entry to avoid adding a WHERE clause.

  3. If you wish to include only a subset of the columns in the table, specify the columns using the sp_add_article_col procedure. You must include the column specified in your subscription expression in the article.

Example 

Top of page  Notes on articles

Top of page  

Collection Contents Index Design overview Publication design for Adaptive Server Enterprise pdf/chap8.pdf