Re: Mass Import/Generate PKs

From: "Goutam Paruchuri" <gparuchuri(at)oneil(dot)com>
To: "Hunter Hillegas" <lists(at)lastonepicked(dot)com>, "PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Mass Import/Generate PKs
Date: 2004-11-08 18:54:22
Message-ID: B2C547DF42419645804F05B54290755ADC7C99@DAYTONEX.oneilinc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes you can use the copy command. Check for

copy TABLE NAME from 'c:\\bcpdata\\Files\\FILENAME.txt' with delimiter
as '\t' NULL as '';

When creating a table, use an incremental column (data type is serial).
Hope the above helps.

- Goutam

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of
> Hunter Hillegas
> Sent: Saturday, November 06, 2004 3:01 PM
> To: PostgreSQL
> Subject: [GENERAL] Mass Import/Generate PKs
>
>
> I have a CSV file with 400,000 lines of email mailing list
> information that I need to migrate to a new PostgreSQL database.
>
> Each line has all the info I need except a PK (I usually use
> an int4 column for a PK).
>
> If the file were smaller I would probably just use Excel to
> pop in a PK and then just load into the table...
>
> Since Excel chokes on files greater than 65k lines, this won't work.
>
> Is there a way to get this done inside psql for instance? Or
> another route?
>
> Thanks,
> Hunter
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to
> majordomo(at)postgresql(dot)org)
>

Confidentiality Notice
The information contained in this e-mail is confidential and intended for use only by the person(s) or organization listed in the address. If you have received this communication in error, please contact the sender at O'Neil & Associates, Inc., immediately. Any copying, dissemination, or distribution of this communication, other than by the intended recipient, is strictly prohibited.

Browse pgsql-general by date

  From Date Subject
Next Message Goutam Paruchuri 2004-11-08 19:04:00 Re: how to use COPY within plperl
Previous Message ru.igarashi 2004-11-08 18:50:26 Re: I spoke with Marc from the postgresql mailing list.