Publishing only some rows using a WHERE clause

You can specify a WHERE clause to include in the publication only the rows that satisfy the WHERE conditions.

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

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

  2. In the left pane, select the Publications folder.

  3. From the File menu, choose New » Publication.

    The Create 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 then type the search condition in the lower box.

  7. Click Finish.

To create a publication using a WHERE clause (SQL)

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

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

Examples

The following statement creates a publication that publishes the ID, CompanyName, City, State, and Country columns of the Customers table, for the customers marked as active in the status column.

CREATE PUBLICATION PubCustomers (
   TABLE Customers (
      ID,
      CompanyName,
      City,
      State,
      Country )
   WHERE Status = 'active'
);

In this case, the status column 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 is a single-article publication sending relevant order information to Samuel Singer, a sales rep:

CREATE PUBLICATION PubOrdersSamuelSinger (
   TABLE SalesOrders WHERE SalesRepresentative = 856
);

See CREATE PUBLICATION statement [MobiLink] [SQL Remote].

SUBSCRIBE BY

The create publication statement also allows a SUBSCRIBE BY clause. This clause can also be used to selectively publish rows in SQL Remote. However, it is ignored during MobiLink synchronization.