Re: Copy Data Question - Mailing list pgsql-novice

From
Subject Re: Copy Data Question
Date
Msg-id 20060623212348.30485.qmail@web33308.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Copy Data Question  (Richard Broersma Jr <rabroersma@yahoo.com>)
Responses Re: Copy Data Question  (Richard Broersma Jr <rabroersma@yahoo.com>)
List pgsql-novice
> > i have 11 columns total.  column 1, 2, 3, 4, 5 and
> 6
> > are NOT NULL.  the rest can be null and, in the
> case
> > of the imported data set, are null.
>
> From:
>
http://www.postgresql.org/docs/8.1/interactive/sql-copy.html
>
> COPY tablename ( column [, ...] )
>
> FROM 'filename'
>
> WITH NULL AS 'null string'
> ;

my code is as follows:

COPY t_temp ( columns here... )

FROM 'C:\\Parts.csv'

WITH NULL AS 'nuls'
;

sorry to drag on here...  i know this s/b simple,
but...

i'm still getting errors.  as an example, i had a
varchar(4) columns rejected 'null string' as being too
long.  now, i thought 'null string' represented NULL -
which isn't any characters long.  i changed it to
'nuls" instead and still got the error (it might've
counted six characters ('Nuls').

okay, so i took away the max 4 character
restriction...  it passed through that column fine,
but now i get...

ERROR:  invalid input syntax for integer: "'Nuls'"
CONTEXT:  COPY t_temp, line 1, column
assembly_instructions_revision: "'Nuls'"

again, it seems to want to actually insert 'Nuls'
instead of interpret it as NULL value.

also notice the error capitalizes Nuls, even though i
call it as lowercase.

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-novice by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: Copy Data Question
Next
From:
Date:
Subject: Re: Copy Data Question