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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;

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
Look at this thread:… 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

Your Answer


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

Browse other questions tagged or ask your own question.