Ask the Expert

Inserting data into a table

Inserting data into a table

I would like to select data from DB2/400 and insert it into a table in a Windows DB2 in one SQL. What is the best way to accomplish this? I am able to do this between two Microsoft SQL Servers by linking one database to another. Is there something similar for DB2?
The DB2 UDB for Windows Enterprise Server edition does include some federated database support that will support this. You would need to configure federated access to you iSeries server including creating a nickname for the DB2 UDB for iSeries table that you're trying to select from. INSERT INTO db2win_table SELECT * FROM db2iseries_nickname

Another alternative supported by DB2 UDB for Windows is:

DECLARE c1 CURSOR FOR SELECT * FROM db2iseries_nickname ; LOAD db2luw_table FROM c1 OF CURSOR REPLACE


Visit the ITKnowledge Exchange and get answers to your DB2 questions fast.

Check out this Featured Topic: Expert advice on DB2's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: Tips, tutorials and more.

This was first published in January 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: