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!

Insert query results into a new table

Status
Not open for further replies.

Jeremiah31

Programmer
Nov 7, 2006
31
US
I'm trying insert query results into a new table. I'm new to IBM DB2, and so far I'm not having very much luck.

I'm trying the formula (just to test)

INSERT INTO TBLTEST (txtTrailerNumber)
(select SSCPGM.WHPMTLDA.TRLR_ID_NO from SSCPGM.WHPMTLDA)

but I'm receiving an error message TBLTEST QCPL type *file not found, what I'm doing wrong?
 
By the look of it, you're on a AS400/DB2 system.
AS400 works with libraries (think of it a schema's)
I you omit the library in the path, then AS400 will default to the system library QGPL. So, you should check where you created the table and then make sure you mention the correct library in the path , like:

<library>.<filename>.<field>

Ties Blom

 
thanks, so far this has been a huge learning curve to overcome. i created an access table called tbltest with field name txtTrailerNumber.
 
I have worked many years with AS400 as a source-system and it is not so accesible as 'normal' RDBMS. However, it offers great native functionality (as you will discover)



Ties Blom

 
If you are trying to insert from the as400 into an access mdb, you will need to use 2 queries. The first is a pass-thru select query that returns the records you want to insert. The 2nd is an access insert query whose source table points to your pass-thru query and destination table points to the local access table you want to insert the records into.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top