Export data using Bteq script

Analytics
ram
Fan

Export data using Bteq script

Hi,

 

I am new for bteq script. I tring to export data from table to text file. While using below script i am facing space issue between columns. Please refer the below screenshot. Due to this issue i am not able to download data from table which is having more than 5 lack. Because the files size are increasing more 5 GB. Can any one help how to solve this issue.

 

bteq <<EOI

.LOGON sever/username,password;


.EXPORT FILE =file1.txt;
.SET SEPARATOR '|';
.SET WIDTH 32767;

DATABASE sample_database;


sel * from sample_table;


.LOGOFF;

.EXIT

EOI

1 REPLY
Junior Contributor

Re: Export data using Bteq script

You currently export your data in REPORT format, which results in fixed width data.

If you want pipe-delimited readable data you can do:

  • concat every column plus a pipe manually
  • or apply the CSV function
  • or simply switch to TPT and use DELIMITED format.