Stored procedures

The script creates the stored procedure upd_publisher_pubs2 at the primary site.

The following script modifies the upd_publishers_pub2_req stored procedure at the replicate site. The insert into clause tells the replicate Replication Server to insert values into the publishers_pend table.

-- Execute this script at Sydney data server
 -- Creates stored procedure 
 create procedure upd_publishers_pubs2_req
 (@pub_id char(4),
 @pub_name varchar(40),
 @city varchar(20),
 @state char(2))
 as
 insert into publishers_pend
 values
    (@pub_id, @pub_name, @city, @state)
 go
 /* end of script */

This script modifies the upd_publishers_pubs2 procedure for the replicate site. It updates the publishers table and deletes the corresponding information from the publishers_pend table.

-- Execute this script at Sydney data server
 -- Creates stored procedure upd_publishers_pubs2
 create procedure upd_publishers_pubs2
 (@pub_id char(4),
 @pub_name varchar(40),
 @city varchar(20),
 @state char(2))
 as
 update publishers
 set
    pub_name = @pub_name,
    city = @city,
    state = @state
 where
    pub_id = @pub_id
 delete from publishers_pend
 where 
    pub_id = @pub_id
 go
 /* end of script */