All Forums Tools
kanna_2013 4 posts Joined 10/13
23 Oct 2013
Need to include column heading in Teradata Bteq script

Hi ,
 
This is my teradata teg script and need to include column heading.
.SET SESSION TRANSACTION ANSI
.BEGIN EXPORT SESSIONS 20;
.RUN    FILE=${ETL_LOGON}
.EXPORT RESET;
.EXPORT DATA FILE = /pmretl/data001/SessLogs/RXDM/market_data.csv
/*Setting format of output file*/
.SET RECORDMODE OFF
.SET WIDTH 65531;
.RETLIMIT 2147483407,2048;
.SET SEPARATOR ",";
.SET NULL AS "";
.SET TITLEDASHES OFF;
.SHOW CONTROLS;
SELECT
VNDR_SRC_MRKT_ID||','||
trim(DATA_SRC_ID)||',"'||
trim(FILE_NM)||'",'||trim(SRC_CD)||',' ||trim(CAST(MSTR_PROD_ID AS integer))||',"'||trim(MRKT_NM)||'",'||trim(CRTN_DT)||' ,'||LAST_UPDT_DT
(title '')
FROM GHHUSDW_PMR_STAGE_ETL.SRC_MRKT_XREF
where data_src_id =8;
 

.EXPORT RESET
.QUIT
 
 

dnoeth 4628 posts Joined 11/04
23 Oct 2013

This is not a working BTEQ script, there's no BEGIN EXPORT in BTEQ.
Simply write a select returning a concatenated list of all column name before you run your actual select:

SELECT
'VNDR_SRC_MRKT_ID'||','||
'DATA_SRC_ID'||','||
...
(title '');

Dieter

Dieter

Raja_KT 1246 posts Joined 07/09
23 Oct 2013

Hi,
you can use thus:
 

.SET TITLEDASHES ON

.EXPORT REPORT FILE= /pmretl/data001/SessLogs/RXDM/market_data.csv

SELECT VNDR_SRC_MRKT_ID,DATA_SRC_ID from GHHUSDW_PMR_STAGE_ETL.SRC_MRKT_XREF .........

 

.EXPORT RESET

 

Cheers,

Raja

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

kanna_2013 4 posts Joined 10/13
24 Oct 2013

sorry  dieter,
I forget to include the below steps in the forum. Now i can get the column heading.thanks for the help!!!!
.SET SESSION TRANSACTION ANSI
.BEGIN EXPORT SESSIONS 20;
.RUN    FILE=${ETL_LOGON}
.EXPORT RESET;

kanna_2013 4 posts Joined 10/13
25 Oct 2013

Hi All,
 
I am getting a Deadlock when I run multiple sessions in parallel which insert into a table in Teradata. Please find the attached below error.
 
  odbc teradata driver error  teradata database transaction ABORTED due to deadloack.unable to get catalog string
 
I rerun the session one by one (sequential order) and the session is completed successfully.
pls help me how to fix this one

manish K S 2 posts Joined 09/15
22 Sep 2015

how i can export file like..
.SET TITLEDASHES ON
.EXPORT REPORT FILE= /pmretl/data001/SessLogs/RXDM/market_data.csv
SELECT VNDR_SRC_MRKT_ID as VSND,DATA_SRC_ID as DSI  from GHHUSDW_PMR_STAGE_ETL.SRC_MRKT_XREF .........
.EXPORT RESET
 
so acn i write VNDR_SRC_MRKT_ID as VSND,DATA_SRC_ID as DSI
like that?

manish

fgrimmer 553 posts Joined 04/09
22 Sep 2015

Manish, please post your BTEQ question to the Tools Forum. thanks.

You must sign in to leave a comment.