Archives of the TeradataForum
Message Posted: Fri, 26 Nov 2004 @ 16:05:14 GMT
Subj: | | Re: Spooling a Teradata table to a text file using .EXPORT |
|
From: | | Michael Larkins |
Hi Vijay:
You did not mention the characteristics or the destination of the output file. So, it is difficult to suggest too much about the file format.
However, the SEL is pretty straight forward based on the believing you want each field in the ouput file to be character (alpha=Ax). Therefore
using ANSI standard SQL instead of the lpad extension in your select you can try the following:
.export data file=$HOME/csm/dat/cs_vendor_cell_offer.dat
select
CAST(id_strategy AS CHAR(9)) id_strategy
,CAST(id_vendor_cell AS CHAR(9)) id_vendor_cell
,CAST(id_cross_sell AS HCAR(8)) id_cross_sell
,CAST(id_offer AS CHAR(9)) id_offer
,CAST(num_priority AS CHAR(9)) num_priority,
,CAST(num_days_between_offers AS CHAR(9)) num_days_between_offers
from cs_vendor_cell_offer
order by id_vendor_cell, num_priority
.export reset
If you are looking for a file without a VLI at the beginning and newline at the end, you could use the .export report instead of data.
However, you will need to using other BTEQ commands like .set heading off and .set titledashes off before doing the SELECT.
Hope this helps get you headed in the right direction.
Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor
|