All Forums Tools
alvaroapi 1 post Joined 02/14
14 Apr 2014
BTEQ - Parametrize output File

Hi all,
I need to export data from Teradata to text files (Windows).
The first one is a .BAT file that only call the BTEQ application:
1 - bteq < file.sql
The second one exports the data:
2 -
.logon myhost/myuser,myuser


.EXPORT FILE=out.txt

select col1, col2

from table1;






Now I need to send a variable from .BAT file to .sql file giving the file name where I want to export data, for example, if the information is related to countries, I want to generate a file by country:


1 - 

bteq < file.sql  Canada

bteq < file.sql  USA

bteq < file.sql  Colombia


2 - 


.logon myhost/myuser,myuser


.EXPORT FILE=%Country%.txt

select col1, col2

from table1

where country='%1%';





How can I do this?
Thanks in advance.

Adeel Chaudhry 773 posts Joined 04/08
15 Apr 2014

You can't do that using TTUs. Yet you can achieve the same results using a little coding in any language .... to give an interface to get variables and replace & execute the scripts.

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.