Re: problems importing from csv

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: stan <stanb(at)panix(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: problems importing from csv
Date: 2019-09-13 18:33:07
Message-ID: CANu8FiwzxkyVMGQN=exmb5OgpakhO_iFKZnhYg2CGBOrQvKaWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>ERROR: invalid input syntax for type numeric: "$1.00"
>CONTEXT: COPY employee, line 2, column hourly_rate: "$1.00"

Try changing the format of the column from currency to numeric BEFORE
exporting.

On Fri, Sep 13, 2019 at 2:22 PM stan <stanb(at)panix(dot)com> wrote:

>
> I am trying to import some data from spreadsheets. Included in the data
> sets are US monetary values. These appear in the CSV file, like this: $1.00
> The column is defined like this: NUMERIC(5,2) NOT NULL. When I try to
> import this data using the \copy functionality, i get the following error;
>
> stan(at)smokey:~/pm_db/live_data$ psql < import_employee.sql
> ERROR: invalid input syntax for type numeric: "$1.00"
> CONTEXT: COPY employee, line 2, column hourly_rate: "$1.00"
>
> How can I work around this?
>
> --
> "They that would give up essential liberty for temporary safety deserve
> neither liberty nor safety."
> -- Benjamin Franklin
>
>
>

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Judy Loomis 2019-09-13 19:03:45 Cascade Trigger Not Firing
Previous Message stan 2019-09-13 18:22:15 problems importing from csv