Re: importing in sql

Поиск
Список
Период
Сортировка
От jmr@computing.com
Тема Re: importing in sql
Дата
Msg-id 20000712.131933.71135909.jmr@computing.com
обсуждение исходный текст
Ответ на importing in sql  (Abdul Karim <karim@thehub.co.uk>)
Список pgsql-sql
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
jmr@computing.com


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: importing in sql
Следующее
От: Henry Lafleur
Дата:
Сообщение: RE: join if there, blank if not