Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

General
description of Bulk Copy Transfer [Table of Contents] How Bulk Copy transfer statements are processed

Access Service User's Guide DirectConnect for AS/400

[-] Chapter 10 Using Bulk Copy Transfer
[-] Syntax for Bulk Copy transfer statements

Syntax for Bulk Copy transfer statements

The required syntax for a bulk copy transfer statement is:

transfer [with report]
{to | from} 'secondaryname
userid password';
with {insert | replace | truncate} into tablename;
sourceselectstatement

where:

Examples

This section contains some examples of bulk copy transfer statement syntax that are submitted through ISQL. The following table shows the database and user information used in the examples.

Information used for bulk copy transfer examples

Transfer Components

Primary Database

Secondary Database

Database

AS/400

Adaptive Server

User ID

as4user

ssuser

Password

as4pass

sspass

Service Name

as4

ss

Table Names

as4table1, as4table2, as4table3

sstable1, sstable2,sstable3

Column Names

as4col1, as4col2, as4col3,...

sscol1, sscol2, sscol3,...

The following examples assume that the source and target databases are datatype-compatible.

Example #1

Task: Transfer data from the AS/400 to append to an Adaptive Server table.

c:>isql -Sas4 - Uas4user -Pas4pass
1>transfer to 'ss ssuser sspass' ;
2>with insert into sstable1 ;
3>select * from as4table3 ;
4>go

Result: Data from the AS/400 table named as4table3 is appended to the Adaptive Server table sstable1

Example #2

Task: Transfer data from Adaptive Server to replace data in the AS/400.

c:>isql -Sas4 -Uas4user -Pas4pass
1>transfer from 'ss ssuser sspass' ;
2>with replace into as4table1 ;
3>select * from sstable3 ;
4>go

Result: Data from the Adaptive Server table named sstable3 replaces the data in the AS/400 table as4table1.

Example #3

Task: Transfer data from two tables in the AS/400 to a single Adaptive Server table.

c:>isql -Sas4 -Uas4user -Pas4pass
1>transfer to 'ss ssuser sspass' ;
2>with insert into sstable1 ;
3>select a.ssno, a.name2, b.empid
4>from as4table1 a, as4table2 b
5>where a.ssno=b.ssno ;
6>go

Result: A social security number (ssno), a name (name2), and an ID (empid) are selected from two AS/400 tables, based on a join of social security numbers. The information is appended to the Adaptive Server table called sstable1.


General
description of Bulk Copy Transfer [Table of Contents] How Bulk Copy transfer statements are processed