Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Copy Data Question



> > 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 



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group