Mahesh S wrote:
Hi Gert
I do have one more query. Hope I am not troubling you too much.
I have successfully created wrappers for two db2 databases located in
different locations. The thing is, they have the exact same structure
but storing different data. I have a table named Patient which stores
patient details pertaining to that location. What I would like to do
is have a single table that would combine records present in the two
db2 tables located in different locations. I am not talking of a join
here but more of sticking records from one table at the end of records
from another table. How do I go about doing that?
You have to create two nicknames. One points to the table in database A and
the other to the table in database B. Then you create a view over both
nicknames and UNION the results:
CREATE NICKNAME n1 FOR server1.schema.table
CREATE NICKNAME n2 FOR server2.schema.table
CREATE VIEW v AS
SELECT * FROM n1
UNION ALL
SELECT * FROM n2
If you still want to distinguish where the data came from, just put this
into the view definition (this is just plain and simple SQL):
CREATE VIEW v AS
SELECT 'n1' AS source, n1.* FROM n1
UNION ALL
SELECT 'n2' AS source, n2.* FROM n2
--
Knut Stolze
DB2 Information Integration Development
IBM Germany