Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to create a CSV with PostgreSQL 9.1 COPY that directly opens correctly with a double-click in crazy German Excel 2010. Using ";"-Delimiter is easy. The encoding is solved, but Excel only recognizes numbers correctly if they use the , as decimal seperator.

Thats what the CSV should look like;

10,7;8,1;90,0;"some, text."

Thats what the CSV looks like now:

10.7;8.1;90.0;"some, text."

Is there a way to do that with COPY?

What I tried:

SHOW lc_numeric;
"de_DE.UTF-8"

is set but has no effect.

I found to_char(double precision, text) function. But my table has ~200 columns. Will I have to put to_char( column , 'FM9999999999999999D999999999999999999') for every numeric column? Is there any setting to make COPY change it automagically?

Thanks in advance, Steve

share|improve this question
2  
Look at this thread: postgresql.1045698.n5.nabble.com/… I'm afraid that you have to find a solution with to_char. I'd expect performing a conversion with Excel may be easier (no actual idea how to do that, just has some faint memories about doing that years ago). –  dezso Mar 6 '13 at 20:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.