INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access 2 different databases from one SQL script

Access 2 different databases from one SQL script

(OP)
Hi,

I wander if i can write INSERT statment, which selects data from table that exists in database1 into table that exists in database2? If yes - what syntax should i use?

It is so simple in TSQL... but does not work in DB2

Thanks in advance!

Eka

RE: Access 2 different databases from one SQL script

Hi Eka,
I've not seen it done like this and have just tried and I receive an error telling me that the remote object is invalid.

From within db2system1 I can select data from a table in db2system2 by giving it the subsystem name e.g if the table in subsystem2 is called owner1.table1 I can run the SQL:

SELECT * FROM subsystem2.owner1.table1

from subsystem1 and get data back, but it seems as if trying to access both subsystems in one statement does not work. I'd be interested if anybody else knows a solution.

Marc  

RE: Access 2 different databases from one SQL script

(OP)
Thanks Marc,

Yes, SELECT * FROM subsystem2.owner1.table1 syntax does not work.. :(

I will post here if i get any answer from other forums.. :)


Eka

RE: Access 2 different databases from one SQL script

Suggest you look here and read about DRDA (Distributed Relational Database Architecture)
http://www.craigsmullins.com/drda.htm

This is NOT complete info, but will give you an idea. You might also ask your database support if this is supported on your system.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close