Re: [ADMIN] How to transfer data from FoxPro data to Postgresql? - Mailing list pgsql-admin

From Terry Mackintosh
Subject Re: [ADMIN] How to transfer data from FoxPro data to Postgresql?
Date
Msg-id Pine.LNX.3.95.980901203531.30076B-100000@terry1.acun.com
Whole thread Raw
In response to How to transfer data from FoxPro data to Postgresql?  ("S.Ramaswamy" <srswamy@giasdl01.vsnl.net.in>)
List pgsql-admin
On Tue, 1 Sep 1998, S.Ramaswamy wrote:

> We have our data now in FoxPro dbf format under DOS. We want to transfer
> this to
> Postgresql under Linux. What is the best way to do so?
> Regards
> S.Ramaswam

Off the top of my head ... in a hurry ... so check syntax ...
in vfp
use table
copy to filename delimited with '|' ..... or some such
check the help for copy.  What you want to end up with is a text file with
all fields pipe delimited '|' and double quotes around any char/text
fields.
Why a pipe?  It PROBABLY does not exist in your data.
...Ya, would be nice to NOT have the quotes, but M$ INSISTS on
putting some thing extra there, so may as well be quotes, which is the
default.

Now, on your Linux box, use sed or awk to strip out the carraige returns
and also to strip out the double quotes that are next to a pipe.
If you don't know sed or awk, get the O'Reilly book "Sed & Awk".
Oh what fun =)

Now, in psql do:
copy tablename from 'filename' delimiter '|' ... or some such
do '\h copy' for exact syntax.

                            *** OR ***

Email the vfp files to me and for $25/hour I will send you back a postgres
dump file :)

Hope that helps
Terry Mackintosh <terry@terrym.com>          http://www.terrym.com
sysadmin/owner  Please! No MIME encoded or HTML mail, unless needed.

Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!


pgsql-admin by date:

Previous
From: "h a"
Date:
Subject: How can i start PostreSQL automatically
Next
From: Terry Mackintosh
Date:
Subject: Re: [ADMIN] How can i start PostreSQL automatically