Chapter 8. SQL Remote Design for Adaptive Server Enterprise

// Create an empty publication

exec sp_create_publication ’SalesRepData’

//Add the Sales Rep table to the publication exec sp_add_article ’SalesRepData’, ’SalesRep’

//Add the Policy table to the publication exec sp_add_article ’SalesRepData’, ’Policy’,

NULL, ’rep_key’

//Add the Customer table to the publication.

//Subscribe by the subscription_list column

//Exclude the subscription_list column

exec sp_add_article ’SalesRepData’, ’Customer’, NULL, ’subscription_list’

exec sp_add_article_col ’SalesRepData’, ’Customer’, ’cust_key’ exec sp_add_article_col ’SalesRepData’, ’Customer’, ’name’

go

Subscriptions to this publication take the following form:

exec sp_subscription ’create’, ’SalesRepData’, ’userID’, ’rep_key’

go

where userID identifies the subscriber, and rep_key is the subscription column, which is the value of the rep_key column in the SalesRep table.

Maintaining the subscription-list column

 

You need to write a procedure and a set of triggers to maintain the

 

subscription-list column added to the Customer table. This section describes

 

these objects.

Stored procedure

The following procedure is used to build the subscription-list column, and is

 

called from the triggers that maintain the subscription_list column.

159

Page 177
Image 177
Sybase DC38133-01-0902-01 manual Subscriptions to this publication take the following form, These objects, 159