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:

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

asked 14 Mar '13, 10:57

ESP's gravatar image

ESP
106449
accept rate: 0%


http://dcx.sybase.com/index.html#1201/en/dbreference/unload-statement.html*d5e64802

Add the following clause to the unload statement:

QUOTE '"'

permanent link

answered 14 Mar '13, 11:16

John%20Smirnios's gravatar image

John Smirnios
8.7k377106
accept rate: 40%

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

Wow, UNLOAD SELECT COMMENT ON is soo fast:)

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×35

question asked: 14 Mar '13, 10:57

question was seen: 2,019 times

last updated: 14 Mar '13, 13:10