Publish only some rows using a WHERE clause

Use the following procedures to create a publication that uses a WHERE clause to include all the columns, but only some of the rows of a table. For information about using the WHERE clause and its alternative the SUBSCRIBE BY clause, see Publish only some rows in a table.

To create a publication using a WHERE clause (Sybase Central)
  1. Connect to the consolidated database as a user with DBA authority.

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

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

  4. In the What Do You Want To Name The New Publication field, type a name for the publication. Click Next.

  5. Click Next.

  6. In the Available Tables list, select a table. Click Add. Click Next.

  7. On the Available Columns tab, double-click the table's icon to expand the list of Available Columns. Select each column you want to publish and click Add. Click Next.

  8. On the Specify WHERE Clauses page:

    1. Click a table in the Articles list.

    2. Type a WHERE clause into the The Selected Article Has The Following WHERE Clause field.

  9. 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 uses a WHERE clause to include the rows you want to include in the publication.

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

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

    The following statements subscribe two employees to the same publication. Both Ann Taylor and Sam Singer receive the same data.

    CREATE SUBSCRIPTION
    TO PubCustomers 
    FOR Ann_Taylor;
    
    CREATE SUBSCRIPTION
    TO PubCustomers)
    FOR Sam_Singer;

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

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

See also