Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 27 Feb 2008 @ 10:43:55 GMT


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


Subj:   Re: Can I give Input values to BTEQ file?
 
From:   Stieger, Etienne E

Hi Kishore,

You wrote:

  Can I give Input values to BTEQ file?  


Answer:

There is a workaround possible via Unix shell scripting. (In any case -> Unix is the only environment one should be using for customization due to the power of it's command-line utilities. Windows cannot come close).

Step 1: Either use a pure Unix environment (best) or use Windows Services for Unix (SFU - free Unix shell environment for Windows, downloadable from Microsoft).

www.microsoft.com...

Obviously bteq needs to be in your path for whatever Unix environment you choose.

Step 2: Then use following shell script (execbteq.ksh):

     #!/usr/bin/ksh
     ########################################################################
     ###
     ### ScriptName: execbteq.ksh
     ###
     ### Created:  Etienne Stieger          2006-10-31
     ### Updated:  Etienne Stieger          2006-11-01
     ###
     ########################################################################
     ### Description: Acts as a low-level wrapper for executing SQL via bteq.
     ### The export file is purely for capturing data output from "select"
     statements.
     ### The SQL Statement (parameter 4) may contain additional directives to
     bteq as required.
     #. ${HOME}/.profile (uncomment this line if there is any need to run
     your user profile)

     ### INPUT PARAMETERS:
     ### $1 = Connect String (dbc, ml1, etc - or empty string "" or '')
     ### $2 = UID
     ### $3 = PWD
     ### $4 = SQL Statement
     ### $5 = Export file name

     bteq << EOF
     .quiet on
     .logon ${1}${2},${3};
     .titledashes off
     .echoreq off
     .export file = '${5}',close
     ${4}
     .export reset
     .exit
     EOF

     RC=${?}

     exit ${RC}

     ### Usage example:
     ### execbteq.ksh dbc myuser mypassword 'Select date;' /tmp/tempfile.txt

Kind Regards

Etienne Stieger
Analytics and Information Management (AIM/EIW)
Standard Bank of South Africa Ltd



     
  <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: 23 Jun 2019