pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nick Fankhauser <nickf@ontko.com>
To: lonh SENG <slonh@camgsm.com.kh>
To: pgsql-admin@postgresql.org
Subject: Re: Execute A String of Query
Date: Wed, 23 Jan 2002 05:46:33 -0500
Message-ID: <NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com> (raw)
In-Reply-To: <014801c1a3b3$6f4c9d50$320010ac@idlonh>

Lon-

>    My delimiter file is as following:
>
>uid|username
>----+---------
>2974|012801849

Assuming all of these values are integers, and the file is called
/home/lon/users.txt, this should work in psql:


create table user_stuff (id Int, name BigInt);
copy user_stuff from '/home/lon/test.txt' using delimiters '|';


The filename must be the full unix path, and you'll nee to remove any
headers or footers that don't contain data.
see this chunk of the manual for more details:

http://www.postgresql.org/idocs/index.php?sql-copy.html

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/




view thread (4+ messages)

Message-ID: <NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com>
Permalink:  ../NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com/
Also on:    postgresql.org/message-id/NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: nickf@ontko.com, slonh@camgsm.com.kh
  Subject: Re: Execute A String of Query
  In-Reply-To: <NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com>
  References: <014801c1a3b3$6f4c9d50$320010ac@idlonh> <NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox