exec sp_grant_remote field_user, file, field
go
Aswith the publisher address, the address of the remote user (field) is a
directoryrelative to the SQLRemote environment variable or registry
entry.As you have not set this value, the address is taken relative to the
directoryfrom which the Message Agent is run. Youshould run the
MessageAgent from your tutorial directory for the addresses to be
interpretedproperly.
Forinformation about setting the SQLRemote value, see “Setting
messagetype control parameters” on page 214.
Create the publication and subscription
Theremaining task is to define the data to be replicated. Todo this, you must
firstcreate a publication, which defines the available data, and then create a
subscriptionfor field_user, which defines the data that user is sharing.
InAdaptive Server Enterprise, they are created with the
sp_create_publicationprocedure, which creates an empty publication, and
thesp_add_article procedure, which adds articles to the procedure. Also,
eachtable must be marked for replication before it can be included in a
publication.
Tocreate the publication
1. Create an empty publication:
exec sp_create_publication SalesRepData
go
2. Markboth the SalesRep table and the Customer table for publication:
exec sp_add_remote_table SalesRep
go
exec sp_add_remote_table Customer
go
3. Addthe whole SalesRep table to the SalesRepData publication:
exec sp_add_article SalesRepData, SalesRep
go
4. Add the Customer table to the SalesRepData publication, using the
rep_keycolumn to partition the table. Thefollowing statement should be
typedall on one line, except for the go:
exec sp_add_article SalesRepData, Customer, NULL, ’rep_key’
go
62