Re: Importing into Postgres from a csv file - Mailing list pgsql-general

From Zorlac
Subject Re: Importing into Postgres from a csv file
Date
Msg-id cyer5.15829$pu4.1135151@typhoon.ne.mediaone.net
Whole thread Raw
In response to Importing into Postgres from a csv file  ("Jake" <ccrasoro@home.com>)
List pgsql-general
You sure can...

put the file somewhere on your db server.. let's just say /tmp and the file
is called data.db

su - postgres
psql [dbname]
copy TABLE from '/tmp/data.db' using delimiters ',';

That'll do ya.. Make sure that the columns are in the right order too... :)

Here's the syntax for the copy command

COPY [ BINARY ] table [ WITH OIDS ]
    FROM { 'filename' | stdin }
    [ [USING] DELIMITERS 'delimiter' ]
    [ WITH NULL AS 'null string' ]
COPY [ BINARY ] table [ WITH OIDS ]
    TO { 'filename' | stdout }
    [ [USING] DELIMITERS 'delimiter' ]
    [ WITH NULL AS 'null string' ]



Jake <ccrasoro@home.com> wrote in message
news:y%Vo5.24467$eR5.721567@news1.rdc1.on.wave.home.com...
> Does any one know if this is possible, and if so how?
>
>
> Jake
>
>



pgsql-general by date:

Previous
From: Zeljko Trogrlic
Date:
Subject: Column name case conversion
Next
From: Tom Lane
Date:
Subject: Re: [Solved] SQL Server to PostgreSQL