export data with column name using Fast export

Tools
N/A

export data with column name using Fast export

Hi,

My requirement is to export data with column name using Fast export script. I have written a script that can export the data to a file but not the column name.

Please advise.

Regards,
Ayes
2 REPLIES
N/A

Re: export data with column name using Fast export

Hi Ayes,
FExp never exports column headers, so you have to start the export with a select returning a single row, e.g.
.export ...;
select * from (select 'col1' || '|' || 'col2' as x) dt;
your_select;

You have to use a Derived Table because without that it's illegal within FExp.

Dieter

Re: export data with column name using Fast export

sel '|'||

CAST(N_NATIONKEY as char(11))||'|'(title''),

CAST(N_NAME as char(11))||'|'(title''),

CAST(N_REGIONKEY as char(11))||'|'(title'') from nation_tpch;

the above type of SQL will give the output with out heaidngs .