When no WHERE clause is specified in a publication definition, all changed rows in the publication are uploaded. You can add WHERE clauses to articles in the publication to limit the rows to be uploaded to those that have changed and that satisfy the search condition in the WHERE clause.
The search condition in the WHERE clause can only reference columns that are included in the article. In addition, you cannot use any of the following in the WHERE clause:
These conditions are not enforced, but breaking them can lead to unexpected results. Any errors relating to the WHERE clause are generated when the DML is run against the table referred to by the WHERE clause, and not when the publication is defined.
To create a publication using a WHERE clause (Sybase Central Admin mode)
Connect to the remote database as a user with DBA authority using the SQL Anywhere plug-in.
Open the Publications folder.
From the File menu, choose New » Publication.
The Create Publication Wizard appears.
Enter a name for the new publication. Click Next.
On the Specify 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.
On the Specify WHERE Clauses tab, select the table and enter the search condition in the lower box. Optionally, you can use the Insert window to assist you in formatting the search condition.
To create a publication using a WHERE clause (SQL)
Connect to the remote database as a user with DBA authority.
Execute a CREATE PUBLICATION statement that includes the tables you want to include in the publication and a WHERE condition.
The following example creates a publication that includes the entire employees table and all rows in the SalesOrder table that have not been marked as archived.
CREATE PUBLICATION main_publication ( TABLE Employees, TABLE SalesOrders WHERE archived = 'N' );
By changing the archived column in the table from any other value to an N, a delete is sent to the MobiLink server during the next synchronization. Conversely, by changing the archived column from N to any other value, an insert is sent. The update to the archived column is not sent to the MobiLink server.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|