SQL Remote User's Guide
A Tutorial for Adaptive Server Enterprise Users
Tutorial: Adaptive Server Enterprise replication
To work through the tutorial, you must have system administrator privileges on an Adaptive Server Enterprise server. The tutorial assumes that your login name is the two-letter word sa and that your password is sysadmin.
The tutorial uses the Adaptive Server Enterprise isql utility. With the login name and password as given above, you can connect to your Adaptive Server Enterprise server using the following command line:
isql -S server-name -U sa -P sysadmin
where server-name is the name of the Adaptive Server Enterprise server to which you connect.
Ensure that you have an appropriate login ID and can connect to your server before starting this tutorial.
Create a database named hq on your Adaptive Server Enterprise server with sufficient space to hold the tables and data required by the tutorial database. A space of 4 Mb is sufficient.
To create a database
Using isql, connect to the server as a user with system administrator privileges:
isql -S server-name -U sa -P sysadmin
Use the master database:
use master go
Create a database named hq. In this example, we use a 5 Mb database with a 5 Mb log, on two different devices:
create database hq on database_device = 5 log on log_device = 5 go
For more information on how to create databases and assign space to them, see your Adaptive Server Enterprise documentation.
You need to install SQL Remote into the hq database.
To install SQL Remote into the hq database
If the system administrator login name you are using does not have the hq database as the default database, make a backup copy of the ssremote.sql script from your installation directory, and add the following two lines to the beginning of the script:
use hq go
Change to the tutorial directory. Then, using isql, connect to the server using the hq database, and run the ssremote.sql script from your SQL Remote installation directory. The following command should be entered all on one line:
isql -S server-name -U sa -P sysadmin -i ssremote.sql
If the system administrator login name you are using does not have the hq database as the default database, make a backup copy of the stableq.sql script from your installation directory, and add the following two lines to the beginning of the script:
use hq go
Using isql, connect to the server using the hq database, and run the stableq.sql script from your SQL Remote installation directory. The following command should be entered all on one line:
isql -S server-name -U sa -P sysadmin -i stableq.sql
Create a directory to hold the files from this tutorial. For example:
mkdir c:\tutorial
You should create a directory for each of the two users of the replication system under your parent directory for this tutorial:
mkdir c:\tutorial\hq mkdir c:\tutorial\field
The next step is to add a pair of tables to the consolidated database.
To add tables to the consolidated database
Connect to the hq database from isql, as a system administrator.
Use the hq database:
use hq go
Create the SalesRep table with the following statement:
create table SalesRep ( rep_key char(12) not null, name char(40) not null, primary key (rep_key) ) go
Create the Customer table with the following statement:
create table Customer ( cust_key char(12) not null, name char(40) not null, rep_key char(12) not null, primary key (cust_key) ) go
Alter the Customer table to add a foreign key to the SalesRep table:
alter table Customer add foreign key ( rep_key ) references SalesRep go
You are now ready for the rest of the tutorial.