Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I have a csv file that unloads a view from our database. It works fine, but the client wants all string data wrapped in double quotes rather than the single quotes as Sybase defaults to.

Does anyone know the command to do this? Here is what I have right now:

SELECT * FROM Sybase_view
TO 'c:\\file.csv' ENCODING 'UTF-8';

asked 14 Mar '13, 10:57

ESP's gravatar image

accept rate: 0%*d5e64802

Add the following clause to the unload statement:


permanent link

answered 14 Mar '13, 11:16

John%20Smirnios's gravatar image

John Smirnios
accept rate: 37%

edited 14 Mar '13, 11:16

Thanks for the help, unfortunately I get an error when I add the quote option

UNLOAD SELECT * FROM Sybase_view TO 'c:\file.csv' ENCODING 'UTF-8'; QUOTE "";

"An error occurred while saving the code. Syntax error near '(end of line)' on line 8"

Any ideas?

(14 Mar '13, 12:50) ESP
Replies hidden

The QUOTE clause goes on the UNLOAD statement, it is not a separate statement afterwards. Remove the ';' statement separator as done below. See the doc link provided above for syntax details.

UNLOAD SELECT * FROM Sybase_view TO 'c:file.csv' ENCODING 'UTF-8' QUOTE "";

(14 Mar '13, 12:58) John Smirnios

Just omit the semicolon before the QUOTE - the QUOTE is a clause that belongs to the UNLOAD statement, just as the ENCODING clause does. - And note, the following chars are one single quote, a double quote and another single quote (just in case that may be not so obvious...)

(14 Mar '13, 12:58) Volker Barth

Remove the semicolon after 'UTF-8'! I.e. use:

UNLOAD SELECT * FROM Sybase_view TO 'c:\file.csv' ENCODING 'UTF-8' QUOTE '"';
(14 Mar '13, 12:58) Mark Culp


That's parallel execution on several "cores" distributed across the Atlantic ocean, with distinct cache, apparently:)

(14 Mar '13, 12:59) Volker Barth

Ok, I figured out my error. I literally typed out two double quotes, instead of copying what you had which is a single quote, followed by a double quote, followed by a single quote again. Thanks so much for your help!

(14 Mar '13, 13:00) ESP
showing 3 of 6 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 Mar '13, 10:57

question was seen: 4,328 times

last updated: 14 Mar '13, 13:10