Stored Procedures

Create the stored procedure upd_publisher_pubs2 at the central (Tokyo) site using the sample scripts.

-- Execute this script at Tokoyo data server
-- Creates stored procedure
create procedure upd_publishers_pubs2
(@pub_id char(4),
 @pub_name varchar(40),
 @city varchar(20),
 @state char(2))
as
   insert into publishers
   values (@pub_id, @pub_name, @city, @state)
go
/* end of script */
This script creates the upd_publishers_pub2_req stored procedure at the remote (Sydney) site. The insert into clause inserts 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 creates the upd_publishers_pubs2 procedure for the remote (Sydney) 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 */