[SQL] COPY isn't working right for me

2001-02-13 Thread Jeff S.

I have a tab delimited file that I'm trying to import
into an empty table.

I've set the table up as follows:

create table member (
member_id serial not null,
fname varchar(25) not null,
lname varchar(25) not null,
member_since date not null,
Primary Key (member_id)
);

My member.txt file looks like this:

Joe Smith   2000/01/14
Frank   Jones   2000/06/21
MikeDavis   2000/09/24

Here's the copy command I use:

COPY member FROM '/tmp/member.txt';

But I'm getting the following error:

ERROR:  copy: line 1, pg_atoi: error in "Joe": can't
parse "Joe"

I'm assuming this has to do with the member_id with
type serial.  How do I import into this without having
to add the OID's to each of the rows in the text file?



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



[SQL] How do I use text script containing SQL?

2001-03-05 Thread Jeff S.

I want to build my tables by placing all the sql
statements in a file. What is the correct way to use
this file with psql?

Example: My text file has this in it:

CREATE TABLE table1 (
   table1_id serial,
   field1  char(5),
   PRIMARY KEY (table1_id)
);

I want to be able to use the file to create my table.
I've tried psql -d databasename -e < filename.txt
but that doesn't work.

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]