All Forums Tools
mtlrsk 30 posts Joined 06/08
26 Jul 2010
Need Header Row in FastExport / TPT Export.?

Hi,

Please can someone send a sample script to export the columnname as the header row using FastExport / TPT Export.?
I am able to do this using Bteq Export, but facing difficulty with FastExport/TPT Export.

Regards,
Mtlrsk.

CarlosAL 512 posts Joined 04/08
26 Jul 2010

You can use a UNION ALL to export the headings:

BTEQ -- Enter your DBC/SQL request or BTEQ command:
SELECT * FROM MY_DB.PRUEBA01 ORDER BY ID_N;

*** Query completed. 10 rows found. 2 columns returned.
*** Total elapsed time was 1 second.

ID_N C_TXT
----------- -------------------------
1 UNO
2 DOS
3 TRES
4 CUATRO
5 CINCO
6 SEIS
7 SIETE

Then a fastexport script like this:

.LOGTABLE MY_DB.PRUEBA01_FXP;

.LOGON MY_DB/user,password;

.BEGIN EXPORT;

.EXPORT OUTFILE blah\blah\blah\PRUEBA01.txt
MODE RECORD
FORMAT TEXT;

SELECT CAST('ID' AS CHAR(2)), CAST('C_TXT' AS CHAR(10))
FROM ( SELECT 'X' DUMMY ) MY_DUAL
UNION ALL
SELECT CAST(CAST(ID_N AS FORMAT '99') AS CHAR(2)), CAST(C_TXT AS CHAR(10))
FROM MY_DB.PRUEBA01
;

.END EXPORT;

.LOGOFF;

You will get the file PRUEBA01.txt:

IDC_TXT
01UNO
02DOS
03TRES
04CUATRO
05CINCO
06SEIS
07SIETE

Watch out the types and sizes!

HTH

Cheers.

Carlos.

mtlrsk 30 posts Joined 06/08
27 Jul 2010

Thanks Carlos, yes it really helped.

So there is no direct approach either via some options in FastExport or some Attributes in TPT to do this?

Thx,
Mtlrsk.

N_Raghu 34 posts Joined 12/13
16 Feb 2014

I also got stuck with same issue. Is there any direct solution other than using "UNION ALL"????

-Raghu

feinholz 1234 posts Joined 05/08
17 Feb 2014

BTEQ is often known (or referred to) as a report writing tool.
It has those capabilities.
FastExport and TPT are high speed bulk loading/unloading tools.
It is best to use BTEQ for the types of tasks you are trying to run.
 

--SteveF

N_Raghu 34 posts Joined 12/13
18 Feb 2014

Thank You Feinholz.. I am trying to export a 6.5 gb file of around 18 million rows with 62 columns...It is a small discomfort on the other end while loading a 62 column file with no column names. I am loading the data into sql server using SSIS.

I also want to ask whether it is a good solution or not? As I tried moving data server to server directly in ssis which took little more than 2 hrs.

-Raghu

feinholz 1234 posts Joined 05/08
19 Feb 2014

TPT cannot load data into any database other than Teradata.
(You can use TPT to move data from a non-Teradata database to Teradata without landing the data to disk.)
However, TPT is a bulk data loading/unloading suite of tools.
We do not include column headers (that functionality is best left to a report writing tool).

--SteveF

You must sign in to leave a comment.