Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 29 Nov 2004 @ 16:24:30 GMT


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


Subj:   Re: Spooling a Teradata table to a text file using .EXPORT
 
From:   Michael Larkins

Hi David:

Thank you for your confidence, I hope it isn't misplaced. I am not sure I understand all the parameters of your quest.

However, since we exported it with BTEQ and it is going back into a Teradata system, we can use BTEQ to import it also (BTW - no need to delete the header record).

     .import report file=D:\WUTemp\cs_vendor_cell_offer5.txt, skip=1
              /* skips header, if header manually deleted, no skip is needed */
              /*  I have never imported a report file, data would have been better
                  on the export and import if you are using BTEQ both ways   */

     USING  /*  needs to match the record format in the file  */
          id_strategy (CHAR(9))
         ,id_vendor_cell (CHAR(9))
         ,id_cross_sell (CHAR(8))
         ,id_offer (CHAR(9))
         ,num_priority (CHAR(9))
         ,num_days_between_offers (CHAR(9))
      INS INTO cs_vendor_cell_offer VALUES (:id_strategy, :id_vendor_cell,
         :id_cross_sell, :id_offer, :num_priority, :num_days_between_offers );
     .quit

Again, using data would be better if coming back into Teradata and using BTEQ both ways. In reality, it would be better export and import the native data types and use indicdata in case of null values. This would also eliminate the header record and eliminate the need to use the skip portion of the import statement.

When you say into another database, should I assume you mean a different Teradata system? If so, this is an acceptable technique assuming you have less than 200K records. If you have more than that, FastExport and Fastload would be faster options.

Another thing I observed that raises a question for me: the table columns appear shorter than the receiving table. It probably would have been better to truncate using the SELECT, especially if you are doing the CAST already. It uses less SPOOL space and doesn't cause the truncation to occur on the input side of the equation.

I hope this gets you to where you need to be with these tables. Again, my biggest concern is the importing of a REPORT format and not entirely sure that IMPORT knows about that format.


Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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