Contents Index Publishing only some columns in a table Altering existing publications

MobiLink Synchronization User's Guide
  Adaptive Server Anywhere Clients
    Publishing data

Publishing only some rows in a table


You can create a publication that contains some or all the columns in a table, but only some of the rows. You do so by writing a search condition that matches only the rows you want to publish.

Sybase Central and the SQL language each provide two ways of publishing only some of the rows in a table; however, only one way is compatible with MobiLink.

In MobiLink, you can use the WHERE clause to exclude the same set of rows from all subscriptions to a publication. All subscribers to the publication upload any changes to the rows that satisfy the search condition.

To create a publication using a WHERE clause (Sybase Central)

  1. Connect to the remote database as a user with DBA authority using the Adaptive Server Anywhere plug-in.

  2. Open the Publications folder.

  3. From the File menu, choose New > Publication. The Create a New Publication wizard appears.

  4. Type a name for the new publication. Click Next.

  5. On the Tables tab, select a table from the list of Available Tables. Click Add. The table is added to the list of Selected Tables on the right.

  6. On the WHERE Clauses tab, select the table and type the search condition in the lower box. Optionally, you can use the Insert dialog to assist you in formatting the search condition.

  7. Click Finish.

To create a publication using a WHERE clause (SQL)

  1. Connect to the remote database as a user with DBA authority.

  2. Execute a CREATE PUBLICATION statement that includes the tables you wish to include in the publication and a WHERE condition.

Examples 

The following statement creates a publication that publishes the id, company_name, city, and state columns of the customer table, for the customers marked as active in the status column.

CREATE PUBLICATION pub_customer (
   TABLE customer (
      id,
      company_name,
      city,
      state )
   WHERE status = 'active'
)

In this case, the status column itself is not published. All unpublished rows must have a default value. Otherwise, an error occurs when rows are downloaded for insert from the consolidated database.

The following example creates a single-article publication that includes order information for sales rep number 856.

CREATE PUBLICATION pub_orders_samuel_singer (
   TABLE sales_order WHERE sales_rep = 856
)

For more information, see the CREATE PUBLICATION statement. Note that the CREATE PUBLICATION statement includes a SUBSCRIBE BY clause. This clause can be used to selectively publish rows in SQL Remote. However, it is ignored during MobiLink synchronization.


Contents Index Publishing only some columns in a table Altering existing publications