Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 02 Jun 2009 @ 22:03:45 GMT


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


Subj:   Re: Insert values into a volatile table
 
From:   McCall, Glenn David

Percent is not a valid data type. Your choices are pretty much to use a valid data type or use a valid data type :-). Refer to the Manual for a complete list of valid data types. Most people probably use Decimal for percentages, or if your TD supports it define a User Data Type (UDT). I think I would just use Decimal.

Regarding your import - it doesn't work like that. To do what you want to do, you will need to use bteq. The alternatives are to import all columns into the table then drop the undesired column when you transfer the data somewhere else or use a script (e.g. perl) to remove the unneeded column from your input file. With the perl DBI module, you could also load the data into Teradata.

Parameterised queries such as the one you are using are positional. That is, the first ? corresponds to the first column in your input file. The second ? corresponds to the second and so on.

In your input the 4th question mark corresponds to the unwanted column whether you want it to or not.

If you use bteq, you can name the parameterised columns and then omit them.

For example you might use (check the exact syntax and column widths, I just made this up on the fly):

     .import text file=data.txt;
     .repeat *
     Using (id char(6),
         Dpt_name char(20),
         Budget   char (20),
         Last_yr  char (20),
         Inc      char (20)
     )
     INSERT INTO DPT(DPT_id, DPT_Name, Budget, Buget_Increace_Rate)
         VALUES (:id, :Dpt_Name, :Budget, :Inc);

Note how the columns in the file are named (Using clause) and that I can now omit columns in the insert? You may find it easier to do the import if you can generate the file as CSV (drop the commas in the number though).


Hope this helps

Glenn Mc

Teradata Corporation
Glenn McCall
Canberra Australia



     
  <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