Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 20 Feb 2001 @ 18:49:07 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Vartext and instr
 
From:   Russ Huntley

Hello everyone,

I'm using multiload to upsert data. The input file I'm using is an ascii variable length text file. The first n fields are fixed length, and the length of the last field "floats" based on the value in the field.

It seems like the only way I can define this type of file is as vartext, a single field as varchar, and then use substr to reference the individual fields in the insert statement.

This works but is a little painful from a documentation standpoint. Have you ever had this problem, or do you know a better way of approaching this?


Thanks,

Russ

     (...)

     .layout lay1;

         .FIELD entirerecord * varchar(36);

     /* Actual file layout
        CategoryId       Char(3)
        DepartmentId   Char(3)
        CategoryName Char(30) */

     (...)

     insert into category
         values (
                 substr(:entirerecord,4,3)
                ,substr(:entirerecord,1,3)
                ,substr(:entirerecord,7,30)
                );

     (...)

     format vartext


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023