karim> The file has the following format
karim> 
karim> field2|field3|field4|field5|
karim> 
karim> Each field is separated by a | (pipe), How do I insert the sequence
karim> number before field2? I have like 30 files in this format and I need to
karim> import them in one table with each line having unique number.  Has
karim> anyone come across similar situation? any help would be greatly
karim> appreciated.

I'd create a new (temporary) table with only these 4 fields, and use
COPY to load it.  Then, insert the data into the real table from the
temp one.  Let postgres assign the serial numbers.
Something like this:
     insert into <foo> (field2, field3, ...) select * from tmptable;
Then you can drop your temp table.

Jim Rowan
DCSI
[EMAIL PROTECTED]

Reply via email to