Subject Re: [IB-Conversions] Migrating database from MS SQL or PostgreSQL
Author Helen Borrie
At 11:28 AM 17-08-00 +0200, you wrote:
>Hello,
>
>I'm in the process of migrating a database from MS SQL to a free
>database. I just managed to convert the Tables and data to
>PostgreSQL, but not the stored procedures, thought. They are
>quite different.
>
>So I tried to migrate the stuff to InterBase 6 under Linux.
>
>The pg_dump feature of PostgreSQL dumped the table definitions
>and I tried to convert them by hand. Only minor changes are
>required. Unfortunately I had to rename some columns which were
>named "Action" and "Sort". I guess they have a special meaning in
>InterBase because I wasn't able to insert those names.

True: they are reserved words (also in Delphi, if you were thinking of
using your database with that, which means also Kylix).

However, in IB 6 you can use reserved words as object names, provided you
include them inside double quotes. This will cause the names to become
case-sensitive, something you would have to watch for and repair if you
have existing applications containing SQL strings.


>My question is if there is a sane way to insert the data
>once the tables are created. I guess I would manage to rename
>the PostgreSQL column definition names equal to the InterBase
>ones to avoid the special names.

How you approach may depend on the type of data you have. The fastest and
most generic way is to output the source data to fixed-length text files,
create external tables in your IB database to read them and then write a
script to convert the data and insert it into the destination tables.

With this method, of course you will get stuck if you have blobs.

There are Windows-based tools around which can pump data from one format to
another, e.g. the Freeware IB_WISQL tool from www.ibobjects.com. It should
be possible to find an intermediate format which that pump can handle.


>Is there a similar mechanism to the
> pg_dump | psql
>thing of PostgreSQL? Would it be more easy to migrate the data
>(or the whole thing) from MS SQL-Server.

I don't know of a tool that can pump directly from M$SQL to InterBase,
other than the BDE's TDatapump (if you have a client/server Delphi) - with
that you can write a simple application and pump to an IB 5.x
database. (it's slow, but it gets you there!) After that, 5.6 to 6 is
dead easy - a simple matter of using the 5.x gbak program to back up the
database in transportable format; and then restoring that backup to 6
using the 6 version of gbak.

If these don't work for you but you do find something that does work, we
would highly appreciate your coming back here and telling us what you
did. We are trying to build up a How-To here. You might like to look back
through the archives of this list at
http://www.egroups.com/messages/ib-conversions to see what's already been done.

Cheers,
Helen

http://www.interbase2000.org
___________________________________________________
"Ask not what your free, open-source database can do for you,
but what you can do for your free, open-source database."
(J.F.K.)