Re: Execute A String of Query

From: "Nick Fankhauser" <nickf(at)ontko(dot)com>
To: "lonh SENG" <slonh(at)camgsm(dot)com(dot)kh>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Execute A String of Query
Date: 2002-01-23 10:46:33
Message-ID: NEBBLAAHGLEEPCGOBHDGAENGEDAA.nickf@ontko.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)ontko(dot)com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jodi Kanter 2002-01-23 18:07:03 sub selects
Previous Message Stephan Szabo 2002-01-23 05:21:00 Re: Execute A String of Query