shell - Whitespaces coming in while exporting data from Teradata BTEQ file -


i have bteq script i'm running shell (ksh). aim export contents of teradata table .csv file. problem while exporting data many white spaces being introduced between columns. have tried
1. trimming individual columns
2. using cast convert each column datatype in char
none of seems help.
bteq code looks (i have used report file since need file headers.

.export report file = exportfilepath.csv; .set separator ","; .set titledashes off; .set recordmode off; .set width 65531; .set errorlevel 3807 severity 0  select    trim('"' || trim(cast(col1 char(256))) || '"') col1,   trim('"' || trim(cast(col2 char(256))) || '"') col2,   trim(cast(col3 integer)) col3,   trim(cast(col4 char(6)))  col4,   trim(col5) col5,   trim(cast(col6 decimal(18,2)) col6,   trim(date) date table a; 

col1 , col2 having lot of white spaces between them.any how can remove white spaces. else can in case? cannot decrease char size since these names variable sizes.

i have added '"' here because col1 , col2 names comma in between them. since exported .csv file needs phrased format not proper.

report format printing, i.e. fixed width plus separator.

to generate comma-delimted data without adding seperators , quoting better use csv this:

with cte  ( select col1,col2,col3,col4.col5,col6,current_date dt    table  ) select str (title '') table   (csv(new variant_type(cte.col1,cte.col2,cte.col3                        ,cte.col4.cte.col5,cte.col6                        ,cte.dt), ',', '"'       ) returns (str varchar(32000) character set unicode)   ) t1; 

or switch tpt & delimited format.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -