Contents Index Publishing only some rows using a WHERE clause Altering existing publications

SQL Remote User's Guide
  SQL Remote Design for Adaptive Server Anywhere
    Publishing data

Publishing only some rows using a subscription expression


You can specify a subscription expression to include a different set of rows in different subscriptions to publications containing the article.

For example, in a mobile workforce situation, a sales publication may be wanted where each sales rep subscribes to their own sales orders, enabling them to update their sales orders locally and replicate the sales to the consolidated database.

Using the WHERE clause model, a separate publication for each sales rep would be needed: the following publication is for sales rep Samuel Singer: each of the other sales reps would need a similar publication.

CREATE PUBLICATION pub_orders_samuel_singer (
   TABLE sales_order
      WHERE sales_rep = 856
)

To address the needs of setups requiring large numbers of different subscriptions, SQL Remote allows a subscription expression to be associated with an article. Subscriptions receive rows depending on the value of a supplied expression.

Benefits of subscription expressions 

Publications using a subscription expression are more compact, easier to understand, and provide better performance than maintaining several WHERE clause publications. The database server must add information to the transaction log, and scan the transaction log to send messages, in direct proportion to the number of publications. The subscription expression allows many different subscriptions to be associated with a single publication, whereas the WHERE clause does not.

To create an article using a subscription expression (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 Publication Creation wizard appears.

  4. Type a name for the publication and click Next.

  5. On the Tables tab, configure the desired values for that table.

  6. On the SUBSCRIBE BY Restrictions tab, use the controls to create the subscription expression.

  7. Follow the remaining instructions in the wizard.

To create an article using a subscription expression (SQL)

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

  2. Execute a CREATE PUBLICATION statement that includes the expression you wish to use as a match in the subscription expression.

Examples 

Users can subscribe to more than one publication, and can have more than one subscription to a single publication.

See also


Contents Index Publishing only some rows using a WHERE clause Altering existing publications