Chapter 7. SQL Remote Design for Adaptive Server Anywhere

A special UPDATE statement for publications

Notes on the trigger

The UPDATE statement in this trigger is of the following special form:

UPDATE table-name

PUBLICATION publication-name

{SUBSCRIBE BY subscription-expression

OLD SUBSCRIBE BY old-subscription-expression

NEW SUBSCRIBE BY new-subscription-expression }

WHERE search-condition

Here is what the UPDATE statement clauses mean:

The table-nameindicates the table that must be modified at the remote databases.

The publication-nameindicates the publication for which subscriptions must be changed.

The value of subscription-expressionis used by the Message Agent to determine both new and existing recipients of the rows. Alternatively, you can provide both OLD and NEW subscription expressions.

The WHERE clause specifies which rows are to be transferred between subscribed databases.

If the trigger uses the following syntax:

UPDATE table-name

PUBLICATION pub-name

SUBSCRIBE BY sub-expression

WHERE search-condition

the trigger must be a BEFORE trigger. In this case, a BEFORE UPDATE trigger. In other contexts, BEFORE DELETE and BEFORE INSERT are necessary.

If the trigger uses the alternate syntax:

UPDATE table-name PUBLICATION publication-name

OLD SUBSCRIBE BY old-subscription-expression NEW SUBSCRIBE BY new-subscription-expression }

WHERE search-condition

The trigger can be a BEFORE or AFTER trigger.

The UPDATE statement lists the publication and table that is affected. The WHERE clause in the statement describes the rows that are affected. No changes are made to the data in the table itself by this UPDATE, it makes entries in the transaction log.

109

Page 127
Image 127
Sybase DC38133-01-0902-01 manual Special Update statement for publications