All Forums Database
teradatatester 69 posts Joined 01/10
31 Mar 2011
Linux - Bteq - Export data to file - How can I remove the extra spaces?

Using these settings the results of my SQL ran using Bteq is written to a file with no column headers, the only thing I can't figure out is how to get rid of the 10 spaces that are written to the export file before the results of the SQL.

.export data file=myFile.out
.set separator "|"
.set recordmode OFF
.set sidetitles OFF
.set TITLEDASHES OFF

For example if my SQL returns the number 4, my output file looks like:
SpaceSpaceSpaceSpaceSpaceSpaceSpaceSpaceSpaceSpace4

RB185048 33 posts Joined 09/08
31 Mar 2011

use trim in the sql to avoid the extra spaces.
I think the column which you are trying to export in file is integer.
hope this works.

Koentje 23 posts Joined 09/04
01 Apr 2011

I know, bteq can generate output files, but it's slow and not made for this kind of work.
Use fast export, extremely fast and easy to use.
By adding an Outmod function, you can have a pipe delimited file, without having a space in your output.

VijayTD77 5 posts Joined 10/10
04 Apr 2011

The other way would be:

Select TRIM(col1)||','||TRIM(Col2)||','||TRIM(Col3)
FROM Table1;

Hope this helps.

Thanks

You must sign in to leave a comment.