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'; |
http://dcx.sybase.com/index.html#1201/en/dbreference/unload-statement.html*d5e64802 Add the following clause to the unload statement: QUOTE '"' 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
|