Domanda

I've got 2 firebird databases

c:\db1.gdb
c:\db2.gdb

both databases schema's are the same so both contain a table

MyTable
-------
Id int
Name varchar(50)
...etc

Its guaranteed that the data is different on both databases, however I need to copy from db2.MyTable into db1.MyTable

A requirement is that I do this using the firebird isql tool.

How would I firstly using isql

-Connect to both db's in one isql command window
-run a sql statement that would do a select all from one table in db2 and insert it into the same table in db1

I'm using firebird 1.5

È stato utile?

Soluzione

This is not possible with FB 1.5. You can do this with Firebird 2.5 using the new "execute statement...external" feature that makes it possible to access another firebird database from inside triggers, procedures and code blocks.

Altri suggerimenti

If you really must do it using isql then you could write select statement which produces insert statements; run the select in db2, save the result into some file and then execute the statements in db1. The select statement would be something like

select 'insert into MyTable(id, name) values ('|| cast(id as varchar(10)) ||','''|| name ||''');' from MyTable;

However the job is much easier to do using something like Clever Components' Interbase DataPump.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top