I wanted to export data from netezza database to CSV file.
The format for the data will be:
col1,col2,col3
OR:
"col1","col2","col3"
I am using the query:
CREATE EXTERNAL TABLE 'H:\\test.csv' USING ( DELIMITER ',' REMOTESOURCE 'ODBC' ) AS
SELECT * FROM TEST_TABLE
Above query is not working when col3 has the field including comma as it is saying to export it using escape char as '\'.
Example table:
A | B | C
a | b | Germany, NA
I tried that too, but I am getting as output in csv:
a,b,Germany\, NA
or by adding quotes to each column I am getting output:
"a","b","Germany\, NA"
Here, I am getting extra '\' character in field. I am looking for the solution to resolve it using the nzsql or external table query method or writing own script methods only.
My expected output without changing field data:
"a","b","Germany, NA"