Teradata FastExport – Part 2

Teradata FastExport Sample Script

 

.LOGTABLE MYDB.STUDENT; /* define restart log */
.LOGON ip_address/username,password; /* DBC logon string*/

.BEGIN EXPORT SESSIONS 10; /* begin export with number of sessions to be used */ 
.EXPORT OUTFILE filepath/output.txt mode record format text; /* identify the destination */

SELECT ((TRIM((COALESCE("TITLE",''))))
 ||'|'||
(TRIM((COALESCE("FIRST_NAME",''))))
 ||'|'||
(TRIM((COALESCE("LAST_NAME",''))))
 ||'|'||
(TRIM((COALESCE("MIDDLE_NAME",''))))
 ||'|'||
(TRIM((COALESCE("EMAIL_ID",''))))
 ||'|'||
(TRIM((COALESCE("MOBILE_NUMBER",''))))
 ||'|'||
(TRIM((COALESCE("MARKS",''))))
 ||'|'||
(TRIM((COALESCE("PERCENT_MARKS",''))))
)(TITLE '') FROM MYDB.STUDENT;

.END EXPORT ; /* terminate the export */
.LOGOFF ; /* disconnect from the DBS */

FASTEXPORT COMMANDS:-

Task Commands-

BEGIN EXPORT

Begins the export task and sets the specifications for the number of sessions with Teradata.

END EXPORT

Ends the export task and initiates processing by Teradata.

EXPORT

Provides two things which are:
The client destination and file format specifications for the export data retrieved from Teradata

A generated MultiLoad script file that can be used later to reload the export data back into Teradata

FIELD

Constitutes a field in the input record section that provides data values for the SELECT statement.

FILLER

Specifies a field in the input record that will not be sent to Teradata for

processing. It is part of the input record to provide data values for the SELECT statement.

IMPORT

Defines the file that provides the USING data values for the SELECT.

LAYOUT

Specifies the data layout for a file. It contains a sequence of FIELD and FILLER commands. This is used to describe the import file that can optionally provide data values for the SELECT.

SQL Commands-

ALTER TABLE

Change a column or table options of a table.

CHECKPOINT

Add a checkpoint entry in the journal table.

COLLECT STATISTICS

Collect statistics for one or more columns or indexes in atable

COMMENT

Store or retrieve a comment string for a particular object.

CREATE DATABASE

Creates a new database.

CREATE TABLE

Creates a new table.

CREATE MACRO

Creates a new macro.

DELETE

Delete rows from a table.

DROP DATABASE

Drops a database

DATABASE

Specify a default database for the session.

GIVE

Transfer ownership of a database or user to another user.

DELETE DATABASE

Removes all tables, views, macros, and stored procedures
from a database.

GRANT

Grant access privileges to an object.

UPDATE

Change a column value of an existing row or rows in a

table.