Re: SELECT QUERY between 2 differend databases on the same server
Posted in 2000
Richard Krenek wrote:
>
> Is it possible to do a query that touches 2 different tables in
> different databases on the same server. Here is the SQL statment that
> they want to use but they want the table doc_update to be in a different
> database than doc_master.
>
> SQL INSERT INTO doc_update
> (doc_global_id, fam_global_id, fam_num_gid, fam_sn,
> source, kind, act_hist_ind, doc_key_date, pub_num,
> rev_sn, sfx_sn, in_lieu_of, most_active, common_gid)
> SELECT doc_global_id, fam_global_id, fam_num_gid, fam_sn,
> source, kind, act_hist_ind, doc_key_date, pub_num,
> rev_sn, sfx_sn, in_lieu_of, most_active, common_gid
> FROM doc_master
> WHERE act_hist_ind = 'A'>
> Why we want to do this you ask!! Because I was asked to. We are
> comparing times to do certain queries/inserts between 4 Databases
> (OpenIngres/Informix/DB2/Oracle) We are using Informix 7.(forgot this
> part). If we do choose Informix it will be replacing OpenIngres that has
> its data spread accross 20 databases and they most likely want to copy
> that structure to Informix and I need to know if that is possible (or
> desirable).
I presume this is IDS?
Just pre-pend the table name with the database name, like so:
<database>:<table>
or if it is on a different database server:
<database>@<dbserver>:<table>
Cheers,
--
Mark.
+----------------------------------------------------------+-----------+
| Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /|
| http://www.informix.com http://www.informixhandbook.com |///// / //|
| http://www.iiug.org +-----------------------------------+//// / ///|
| |This email will self-destruct in |/// / ////|
| |10 sec. If you received this email |// / /////|
| |in error, sorry about the mess. |/ ////////|
+----------------------+-----------------------------------+-----------+