Sei sulla pagina 1di 10

Teradata 13.

0
Router Transformation using Fast load Utility

Description:
BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Guide for building financial data model in Teradata. The document focuses on how the real world requirement should be interpreted. The mapping document template with very simplified steps and screen shots makes the complete learning so easy. The document focuses convert rows to column. Join our professional training program and learn from experts.

History:
Version 0.1 0.1 Description Change Initial Draft Review#1 Author Anil Tekam Amit Sharma Publish Date 12th Aug 2011 18th Aug 2011

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 1

Introduction:-

In this document, we have performed the row to column transformation on account type source table data. 1. For this operation we have used the fast export for converting row to column. 2. We also used the fast load utility for loading the data into target table.

Summary:- In this transformation, we use the fast export utility because of this utility we can use the export operation and this will help for converting the row to column. Then we use the fast load utility to load the data into target table.

Creating mapping sheet of Source to Target Table:-

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 2

Converting Rows to Columns Using Fast Load Utility Step #1:- In this example, we convert the row's data to column data using
with fast export utility and after that we load that converted data into another target table with the help of fast load utility. We are showing the source table and target table.

Source Table

Target Table

Step #2:-Below is the source table data. This source table data we convert
from row to column using fast export.

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 3

Step #3: Now we use the fast export utility for converting the row to column
data. We have written the select query and this query help for generating the data in the form of row data to column data. 1.) 2.) 3.) 3.) 4.) BEGIN EXPORT STATEMENT. DEFINE THE OUTPUT FILE NAME. DEFINE MULTI LOAD INPUT SCRIPT NAME THE SELECT PULLS DATA FROM TABLE (SRC_ACCOUNT_OFFICER_CD). END THE JOB AND LOGOFF TERADATA.
ALWAYS GOOD TO IDENTIFY THE SCRIPT AND AUTHOR IN COMMENTS

/* ---------------------------------------------------------------*/ /* @(#) FASTEXPORT SCRIPT */ /* @(#) Version 1.1 */ /* @(#) Created by BISP Team */ /* ---------------------------------------------------------------*/

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 4

Step #4:-Now we execute this fast export script in command prompt. After
execution of fast export flat file generate the output log file and system generate output data file.

Step #5:- Fast export flat file has successfully executed and it has generated
output log file and system generated output data file. This system generated file contains the output data.

Step #6:- We are showing the system generated output data file and this
output data will load into the target table with the help of fast load utility.

Step #7:-Now show the fast load input script. With the help of this script we
will perform the insert operation in empty table. 1.) LOGIN ONTO TERADATA. 2.) DEFINING INPUT DATA FILE 3.) DEFINING THE ERROR FILES 4.) FAST LOAD PERFORM END LOADING. 5.) DEFINE LOGOFF CONNECTION
www.bispsolutions.com | THE www.hyperionguru.com | author in comment. /* FASTLOAD SCRIPT TO LOAD */ script and /* Financial.SRC_ACCOUNT_OFFICER_CD www.bisptrainings.com | Page 5 TABLE */
/* Version 1.1 */ /* Created by BISP Team */ /* ++++++++++++++++++++++++++++ */ /* ++++++++++++++++++++++++++++ */ Always good to identify the

1.) LOGIN ONTO TERADATA:- we logon into the teradata fast load utility. 2.) DEFINING INPUT DATA FILE:- Now we comes the DEFINE statement. Fast load must know the structure and the name of the flat file to be used as the input flat file or source file for loading the data. 3.) DEFINING THE ERROR FILES:- In this script, there is no create table statement for the error tables. This error files work as error table. Fast load automatically
generate both error table. In this instance, they are named emp1_rnk and UV_rnk table. First error table (emp1_rnk) contains only constraints based related error and second error table (UV_rnk) contains only unique violation error.

4.) FAST LOAD PERFORM END LOADING:- The target table must be empty at the loading time and if the loading has completed, then we use the END LOADING statement. If we don't use the END LOADING statement then we get error i.e. Target table being loaded and that time we can't access the loading data. 5.) DEFINE LOGOFF CONNECTION:Now all the sessions has logoff. This is the last statement of this fast load script. Now the table lock has released and if no rows in the error table, then that error table automatically dropped and if there is any single row in error table then we check it, then we take appropriate action and drop that error table manually.

Step #8:-Now we execute this fast load input flat file script in command
prompt. After execution of this script, it will generate the fast load output log file script .

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 6

Step #9:-This fast load input flat file script has successfully executed and it
has generated the fast load output log file script.

Step #10:-Show the fast load output log file script. This script contains all
step by step process of execution of fast load input flat file. This fast load utility generate some phase after the execution 1.)DEFINING LOGON CONNECTION. 2.)INSERT PHASE. 3.)END LOADING PHASE.

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 7

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 8

1.)DEFINING LOGON CONNECTION:- In this logon statement, we have successfully created the logon connection of fast load utility. 2.)INSERT PHASE:- In this insert phase, we have performed the DML operation i.e. insert operation. In this insert operation, we are sending all 11 records from system generated output data file (rank_data.txt) into target table i.e. SRC_ACCOUNT_OFFICER_CD table. 3.)END LOADING PHASE:- In this END LOADING PHASE, we have completed the loading process into the target table. We have read total 11 records from output data file and now we have applied the insert operation in all 11 records. There is no error in error table 1 and error table 2. We can manually drop both the error table from the database, where the error table place and also we are not loading any duplicate rows then total duplicate rows is zero.

Step #12:-Now we are showing the result of target table i.e. TRG_ROW_COL table. In this result, we have shown the converted row to column data. That data has loaded into target table with the

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 9

help of fast load utility. For showing the result we are using the following sql querysql query:- SELECT * FROM FINANCIAL.TRG_ROW_COL;

www.bispsolutions.com www.bisptrainings.com

| |

www.hyperionguru.com Page 10

Potrebbero piacerti anche