I am trying to export an SQL query from a table - this is in a standard query format i.e.
INSERT INTO DATABASE_A.TABLE_B
WHERE TABLE_A.REF_1 = 0;
I then use bteq to export it in to a file so I can execute queries in order. I want to preserve the format of the query (as it can contain comments) however on export - the file is presented with:
^D▒^D▒INSERT INTO DATABASE_A.TABLE_B
The code I am using to export is:
.EXPORT DATA FILE=rw_test_sql.dat
.SET RECORDMODE ON;
.SET SEPARATOR 0;
.SET NULL AS '';
.SET SESSION CHARSET 'UTF8';
.set titledashes off;
.IF ERRORCODE <> 0 THEN .QUIT 8
I am using Solaris 10 on KSH. so my question to you is do you know what the cause of this is and how to resolve it?
.SET RECORDMODE OFF; does solve it however the SQL comes in its unformatted text causing it to fail with comments.
DATA : returns the results of a query to a file for processing by other programs. BTEQ returns data in Record mode and stores it in FastLoad format output file. Use this format to interchange data between BTEQ, FastLoad, and FastExport. MultiLoad also accepts the FastLoad format.
Please use REPORT instead of that then you will not get any control chars.
.EXPORT REPORT FILE