BTEQ exporting multiple files based on column value in a table

Tools
uco
Enthusiast

BTEQ exporting multiple files based on column value in a table

Hi 

Can anyone please give me some thoughts  on this

I have a scenario where I need to create multiple extract files based on a column values using bteq script and in unx environment.

example 

 table abc 

C_Name   ID

xxxxx        1

yyyy          1

aaaaa       2

bbbbb       2

ccccc         1

Now i need to create  files based up on ID and the outfile  name should Name_ID.txt (Eg: Name_1.txt).

And Name_1.txt should have 1's Data only...

There are many more columns in the extract but for example i am using 2 columns

thanks

Krish

Tags (3)
1 REPLY
Teradata Employee

Re: BTEQ exporting multiple files based on column value in a table

You can try with two bteq scripts. Run 1st betq script and get the unique IDs exported to a file. With a shell script, read the exported file and pass value and call 2nd bteq script which export the data with a WHERE clause as the passed value.