Re: Copy command and import - MS SQL Server to Postgres - Mailing list pgsql-general

From Allen Landsidel
Subject Re: Copy command and import - MS SQL Server to Postgres
Date
Msg-id 88f1825a0411051348701ce02e@mail.gmail.com
Whole thread Raw
In response to Copy command and import - MS SQL Server to Postgres  ("Goutam Paruchuri" <gparuchuri@oneil.com>)
Responses Re: Copy command and import - MS SQL Server to Postgres
List pgsql-general
On Fri, 5 Nov 2004 16:31:21 -0500, Goutam Paruchuri
<gparuchuri@oneil.com> wrote:
>
> Iam trying to import data from ms-sql server to postgres. I export the data
> which has datetime columns in sql server using BCP. I use the following to
> import back into postgres.
>
> copy tablename from 'c:\\bcpdata\\mcfa\\tablename.txt' with delimiter as
> '\t'
>
> I get the following error !!
> invalid input syntax for type timestamp: ""
>
> My input file has the timestamp value like
>
> 2004-09-30 11:31:00.000
>
> Any clues ???

I recently did the same thing, I left DELIMITER alone since \t is the
default, but I did have to do "WITH NULL as ''" since some of the
datetimes in MSSQL were empty.

By default the copy will bomb out on NULL fields even if you don't
have a NOT NULL constraint on the column, for one reason or another.

I suppose "WITH NULL as NULL" would've worked just as well, in hindsight.

-Allen

pgsql-general by date:

Previous
From: "Goutam Paruchuri"
Date:
Subject: Copy command and import - MS SQL Server to Postgres
Next
From: "Marc G. Fournier"
Date:
Subject: Re: ALERT This mailing list may be voted into a newsgroup