Re: Execute A String of Query

Поиск
Список
Период
Сортировка
От Daniel Andersen
Тема Re: Execute A String of Query
Дата
Msg-id S38FJyXde2kqkOzV8Q30000443e@smtp02.iprimus.net.au
обсуждение исходный текст
Ответ на Execute A String of Query  ("lonh SENG" <slonh@camgsm.com.kh>)
Список pgsql-admin
>     I am really new to Postgres. But I am familiar with SQL Server.
>
>     I want import data from delimiter file.
>     How can I do this?
>     My delimiter file is as following:
>
> Regards,
>
> lonh

I'm not sure if theres a neater solution out there, but I usually just pipe
it through a one liner perl script and then back into psql, sorta like

cat filename|perl -ne 's/\|/,/g; chop $_; print "insert into tablename values
($_);\n"'|psql databasename

under the bash shell. Of course this all gets a bit messy if there are
strings involved, but works nicely for numerical data. although the example
given suggests you have access to the original database, in which case simply
pg_dumping it is a much easier solution :)
    Daniel

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

Предыдущее
От: Mohd Toha Taifor
Дата:
Сообщение: Dynamic columns
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Execute A String of Query