Convert table from postgresql to DBF

750 views
Skip to first unread message

Hernan Señuk

unread,
Dec 23, 2016, 10:29:27 AM12/23/16
to PgDBF
Hello. First of all. sorry for my English. I am from Bs. As. Argentina.
My problem, is that we have an old system in FoxPro in production. I have a CARGO.DBF table that has more than 2 million records. As I do not know the language of foxpro, I make the modifications and updates by means of SQL with the POSTGRES, which helped me this program, to be able to convert DBF tables to POSTGRESQL without any problem.
But now my problem is that once I work the tables in SQL I must re-pass them to DBF. Does the program have this function? Of being able to transform from SQL to DBF. With other queries with fewer records, I copy them to an XLS file, and then convert it via ACCESS and that's it, but since it has so many records, I can not do that.
Again I apologize for my English, and thank you for the help you can give me.
Thank you!

Philipp Wollermann

unread,
Dec 25, 2016, 3:35:09 PM12/25/16
to Hernan Señuk, PgDBF
Hi Hernan,

thanks for checking out pgdbf! Unfortunately pgdbf only works in the direction of DBF -> SQL, but not the other way around.

I can think of two possible ways to solve your problem:

1) Try to use a different software just for the SQL -> DBF step. For example, I found one that claims to be able to convert CSV -> DBF. You could export your modified postgres database to CSV files, then use that tool to create DBF files: http://www.dbf2002.com/csv-converter/convert-csv-to-dbf.html - I have never used it myself, though. I just found it while googling for some ideas.

2) Try to use the dbase module of PHP to write a little script that dumps your SQL database into a DBF file: http://php.net/manual/en/ref.dbase.php - it shouldn't be too difficult, but I don't know if the dbase support of PHP is any good.

Hope that helps a bit.

Cheers,
Philipp
> --
> You received this message because you are subscribed to the Google Groups "PgDBF" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pgdbf+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Hernan Señuk

unread,
Dec 26, 2016, 7:56:35 AM12/26/16
to PgDBF

Hi. Thank you very much for the quick response, and Merry Christmas!
Yes, that program already uses it, and this message says: "sorry, unregistered version allows you to export only 50 records ..."
From the postgresql I did this query: COPY public.example to 'C: \ example \ example.csv' delimiters ';' WITH CSV HEADER;
And to CSV file I export it well, to do this I do from Windows since in Linux it brought me some problems. But I still could not export to dbf. Since both Excel spreadsheets and free office I open up to 1048576 rows.
I recently opened the CSV file with an Access and then pass it to dbf. Although it is quite work.
I'm going to try the php script that you passed me.
Thank you very much!
Reply all
Reply to author
Forward
0 new messages