All Forums Teradata Applications
Srichakra 15 posts Joined 11/11
12 Jun 2015
Export multiple SQL's results into single excel sheet by sheet

Hi To all,
            I have a set of queries, for that i have created bteq export and on a weekly basis and want to export the results into 1 Excel spreadsheet. Currently, the export into single is a manual effort like copying 5 query results into 5 separate tabs of the same spreadsheet then emailing to 10 vendors. Is there a way to automate this process ? Like in single BTEQ only i want to export all the query results into single excel.
            Please help me out on it.
 
 

Srichakra 15 posts Joined 11/11
16 Jun 2015

Hi Team,

Please kindly help me on this issue.Its pretty urgent..How to export more than 1 files from BTEQ to single file(Sheet By Sheet)

gbansal 18 posts Joined 02/11
24 Jun 2015

why do want to use Excel ?
You can create comma separated file . keep the extension .txt
Run all the queries one bye one , either export same data in one file or export dat of all queries in 5 files and cocatenate those files and keep the extension as csv

Pavi 1 post Joined 10/11
29 Jun 2015

Hi,
Can anyone please help me ASAP.I want to export a excel file  using bteq export comand
im using .EXPORT DIF FILE="$DATADIR/business_email.csv". but still im facing some formatting issues.And when i execute in unix environment it generates all the column retrived.
when i send a mail with below code

uuencode  ${path1}/business_email.xls ${path1}/business_email.csv | mailx -s "My Report" abcmail.com

 I get only few columns of exported data from table  in excel and that to all fields on same column in excel file.
 
so can anyone help me in Excel formatting and to export data in correct columns in excel file.
 
Below code i have written for exporting to csv file

.RUN FILE ".logon"

-------Getting Input varaibles------
.EXPORT DIF FILE="$DATADIR/business_email.csv"
.set width 65473;

SEL
TRAN_DATE,
CALC_DATE_TIME,
 COMPUTED_AMOUNT AS EDW,
 COMPUTED_BASELINE_AMOUNT AS MRKTG,
 VAR_AMOUNT,
VAR_PER,
 CASE WHEN  DAY_NUMBER IN (1,7) THEN MD.WKEND_TOL_BUS ELSE MD.WKDAY_TOL_BUS  END AS  SET_TOL,
 CASE WHEN  DAY_NUMBER IN (1,7) THEN 'WEEK END' ELSE 'WEEK DAY' END AS TRAN_DAY_TYPE
FROM
METRIC_ATT  MA 
LEFT  OUTER JOIN .MET_DEF MD
ON  MD.METRIC_NMB=MA.METRIC_NUM;

.EXPORT RESET;


.LOGOFF;

.EXIT
abc

 
 I want my excel report to be generated in below format.

 

Report Caluculation Date:  3/26/2015

 

 

 

100.A.Sales Stores

 

 

 

 

 

 

Tran date 

calc_date

EDW

mrktg

VAR

PC

Set Tol 

Transaction Day type

 

########

########

########

########

($222,222.00)

-2.22%

1.00%

weekday

 

########

3/1/2015

########

########

($200,000.00)

-2.00%

1.00%

weekday

 

########

3/2/2015

########

########

($111,000.00)

-1.11%

1.00%

weekday

 

jammy19031989 8 posts Joined 07/13
07 Apr 2016

Hi,
I have a situation here.
I have 2 SQLs in a single bteq and I am exporting 2 SQLs into separate excel sheets.

.EXPORT REPORT FILE = Filepath\tab1.csv 

SEPARATOR ',' 

 

sel * from tab1;

 

.EXPORT RESET  

 

.EXPORT REPORT FILE = Filepath\tab2.csv 

.SET SEPARATOR ',' 

 

 sel * from tab2;

 

.EXPORT RESET  

.quit

.logoff
 
I would like to get the output in tabs rather than separate CSV file like tab1 and tab2 in different sheets in the same excel file.
please do the needful asap!!

DiEgoR 33 posts Joined 08/06
24 May 2016

Teradata basic utilites are pretty lame regarding basic MS office related stuff. I understand, they were developed before MS was even a company. But it makes the life of an analyst rather frustrating nowadays. Just to export results in a lingua franka MS Excel format is a challenge :-)

input output putput

You must sign in to leave a comment.