Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to query data from another database

Status
Not open for further replies.

newlearner

Programmer
Dec 14, 2000
1
0
0
CA
Hi all,
I'm brand-new to db2. I created a database called SAMPLE02 from SAMPLE backup. When I connect to SAMPLE02, I can query something like this:
connect to SAMPLE02
select * from SAMPLE02.db2admin.sales
Now, how can I query data from SAMPLE?
(I want to insert data into SAMPLE02.db2admin.sales from
SAMPLE.db2admin.sales)
Thanks very much,
 
You cannot query in a single sql in two databases in db2 unless you use IBM DB2 Data Joiner software

HTH
GK
 
I am assuming the following :
1) There is data in Sample.db2admin.sales
2) The new table Sample02.db2admin.sales is identical
(i.e. All the columns are the same as Sample).
3) The new table Sample02 is empty.

Try the following query to Insert data in to sample02.db2admin.sales from sample.db2admin.sales.

Insert into sample02.db2admin.sales
Values (Select * from sample.db2admin.sales);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top