I'm attempting to extract data into a CSV where one or more columns may 
contain a description that I would like surrounded by quotation marks. 
 Without any CSVOptions each column of data is enclosed in quotation marks 
so I set the field delimiter to blank which effectively eliminates part of 
the problem.  The query I'm executing is below

*call csvwrite('[some_file_path]','*
* select A, B, description*
* from SOME_TABLE*
* where A like ''x%''*
* order by A, B*
*', 'fieldDelimiter= ');*

Because the descriptions column may have commas in it, i'd like to place 
quotes around it and have updated the query as follows

*call csvwrite('[some_file_path]','*
* select A, B, ''"'' || description ''"'' as description*
* from SOME_TABLE*
* where A like ''x%''*
* order by A, B*
*', 'fieldDelimiter= ');*

but the resulting output is

*A,B,Description*

*val1,val2,""some description""*


containing two sets of quotes on each side of the string.  Not what I was 
expecting, so I tried

*select A, B, chr(34) || description || chr(34) as description*


and the result is the same.

How do I go about producing

*A,B,Description*

*val1,val2,"some description"*

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to