Chapter 6. Principles of SQL Remote Design

UPDATE statement may differ from the entered UPDATE statement.

UPDATE statements If an UPDATE statement has the effect of removing a row from a given replicated as INSERTS remote user’s subscription, it is sent to that user as a DELETE statement. If

or DELETESan UPDATE statement has the effect of adding a row to a given remote user’s subscription, it is sent to that user as an INSERT statement.

The figure illustrates a publication, where each subscriber subscribes by their name:

ConsolidatedAnn

 

ID

Rep

Dept

 

 

ID

 

Rep

 

 

1

Ann

101

 

 

1

 

Ann

 

 

 

 

 

 

 

 

 

 

 

 

2

Marc

101

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3

Marc

101

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Consolidated

 

 

Ann

 

 

 

 

 

 

 

 

 

 

 

 

 

ID

Rep

 

Dept

 

 

ID

 

Rep

 

1

Ann

 

101

 

 

1

 

Ann

 

 

 

 

 

 

>

 

 

 

 

2

Marc

 

101

3

 

Ann

 

 

 

 

 

 

 

 

 

 

 

 

3

Ann

101

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Marc

ID

Rep

2

Marc

 

 

3

Marc

 

 

Marc

ID Rep

2 Marc

3 Marc

 

An UPDATE that changes the Rep value of a row from Marc to Ann is

 

replicated to Marc as a DELETE statement, and to Ann as an INSERT

 

statement.

 

This reassignment of rows among subscribers is sometimes called territory

 

realignment, because it is a common feature of sales force automation

 

applications, where customers are periodically reassigned among

 

representatives.

UPDATE conflict

An UPDATE statement changes the value of one or more rows from some

detection

existing value to a new value. The rows altered depend on the WHERE

 

clause of the UPDATE statement.

 

When SQL Remote replicates an UPDATE statement, it does so as a set of

 

single-row updates. These single-row statements can fail for one of the

 

following reasons:

 

The row to be updated does not exist Each row is identified by its

 

primary key values, and if a primary key has been altered by some other

 

user, the row to be updated is not found.

79

Page 97
Image 97
Sybase DC38133-01-0902-01 manual Statement, Representatives, Clause of the Update statement, Following reasons