From: | Daniel Andersen <zedar(at)free2air(dot)com(dot)au> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Execute A String of Query |
Date: | 2002-01-23 04:25:18 |
Message-ID: | S38FJyXde2kqkOzV8Q30000443e@smtp02.iprimus.net.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-01-23 05:21:00 | Re: Execute A String of Query |
Previous Message | Mohd Toha Taifor | 2002-01-23 03:53:37 | Dynamic columns |