Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 21 Feb 2012 @ 15:42:54 GMT


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


Subj:   Re: Executing query stored in a table through BTEQ
 
From:   Dave Wellman

Hi Debojit,

This can be done. Code your Bteq script as follows:

     .OS rm mysql.txt

     .EXPORT REPORT file = mysql.txt

     Sel Col2  (title '')
     from sample_table  where col1 = 1;

     .EXPORT RESET;

     .RUN FILE = mysql.txt

What happens is that 'result' from your first select gets written to a text file and the "run file" command reads that back in as an sql request that Bteq executes.

That will probably work ok, but if your sql is too long (more than 80 characters by default) then you may have to use SET WIDTH before the EXPORT REPORT to allow the full length of sql.


Cheers,

Dave



     
  <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