A publication describes the set of data to be replicated. In this lesson you create a publication named SalesRepData that replicates all rows of the SalesReps table, and some rows of the Customers table. You subscribe a user to a publication by creating a subscription.
If you are not currently connected to the consolidated database (hq), run the following command:
dbisql -c "UID=DBA;PWD=sql;SERVER=server_hq;DBF=c:\tutorial\hq.db" |
Execute the following statement to create a publication named SalesRepData:
CREATE PUBLICATION SalesRepData ( TABLE SalesReps, TABLE Customers SUBSCRIBE BY rep_key ); |
The SalesRepData publication publishes:
The entire SalesReps table
All of the columns in the Customers table but only the rows that match a specified rep_key value
Execute the following statement to create a subscription to SalesRepData:
CREATE SUBSCRIPTION TO SalesRepData ('rep1') FOR field_user; |
The value rep1 is the rep_key value for the user Field User in the SalesReps table.
In this tutorial, there is no protection against duplicate entries of primary key values. For information, see Creating SQL Remote systems.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |