Re: help with COPY query

From: Bruno LEVEQUE <bruno(dot)leveque(at)net6d(dot)com>
To: Elinor Medezinski <elinor(at)bellatrix(dot)tau(dot)ac(dot)il>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: help with COPY query
Date: 2004-02-28 23:54:01
Message-ID: Pine.LNX.4.58.0402290050250.1028@moissac.leveque.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I think the better is to modify you file before.
With sed it should be something like :

sed "s/\(\tab[0-9][0-9]*\).[0-9][0-9]*\(\tab\)/\1\2/" file > newfile

where \tab is the tabulation (or ctrl-V ctrl-I)

You can do the same with vi

vi file
:%s/\(\tab[0-9][0-9]*\).[0-9][0-9]*\(\tab\)/\1\2/
:wq

Bruno

On Tue, 24 Feb 2004, Elinor Medezinski wrote:

> Hi,
> I want to load a file containning a column of FLOATS, into a table of
> INTEGERs.
>
> I tried:
> COPY "Field" ("myintegers") from './myfloats.txt';
> but got an error message:
> ERROR: invalid input syntax for integer: "15.0"
> CONTEXT: COPY Field, line 1, column WatchFreq: "15.0"
> How can I go around this problem? is there any way to force copy to do the
> right casting?
>
> Thanks in advance,
> Elinor
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>

Bruno LEVEQUE
System Engineer
SARL NET6D
bruno(dot)leveque(at)net6d(dot)com
http://www.net6d.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2004-02-29 01:13:30 Re: Compilation issue with --enable-thread-safety
Previous Message joseph speigle 2004-02-28 16:49:55 Re: installing pgsql