+ Reply to Thread
Results 1 to 7 of 7

Thread: SQL statement INSERT INTO db2 file from an Access Table

  1. #1
    Guest.Visitor Guest

    Default SQL statement INSERT INTO db2 file from an Access Table

    If the db2 file is defined as a linked table within the Access DB you would be able to do this. INSERT INTO MYLIB_MYFILE (SELECT * FROM myAccess table...)

  2. #2
    TonyT Guest

    Default SQL statement INSERT INTO db2 file from an Access Table

    REVERSE VERSION: IS IT POSSIBLE TO INSERT FIELDS TO AN ACCESS FROM DB2 LIKE: INSERT INTO ACCESS ( SELECT * FROM DB2 ). ANY CODE EXAMPLE IS VERY MUCH APPRECIATED. THANKS

  3. #3

    Default SQL statement INSERT INTO db2 file from an Access Table

    Mike, Your "linked table" response, actually, that is what I am doing now to get the Access data into the 400 is through the linked table. Since my link is already defined, I should have the ability to do this--great. I intended to delete this link when I had the vb.net program working, but from what you had just told me, it looks like I will need to keep this. Just curious, if the link was not defined within Access, would there be any other way within .NET & recordsets that I could accomplish this?? Thanks for your response! Diane

  4. #4

    Default SQL statement INSERT INTO db2 file from an Access Table

    Diane, I no loner work with ACCESS and VB on a regular basis.... But if there are no restricitions on having connections open to two separate databases, this might work. Open a connection to ACCESS Open an ODBC connection to the AS400 Create the ACCESS recordset Iterate through all rows For each row Retrieve the data you need from the ACCESS columns Build an SQL INSERT statement in a string variable, similar to this: strsql= "INSERT INTO AS400Table (FLD1) VALUES(" + "'" COL1 +"'" + ")" Pass the String Variable to the Execute Method of the AS400 connction Object. Next Row

  5. #5

    Default SQL statement INSERT INTO db2 file from an Access Table

    Mike, I wondered about that process, read a record, write a record, wasn't sure if I should do it that way. Really was hoping to insert my selection - which I do have that working now with the help of Mike Faust, (insert to the 400 file (select from the access table) using the "linking" table as he suggested. Just for testing and learning, I will try the logic that you have described above to see how I can work with two open connections and inserting each record, one at a time. Thanks for your post! Diane

  6. #6

    Default SQL statement INSERT INTO db2 file from an Access Table

    I'm testing a .NET application that contains a recordset from a sql statement, (select * from myfile where etc....). Now that I have the records, I would like to INSERT INTO mylib.mydb2file, using the data from the above select statement. In theory----> INSERT INTO mylib.myfile (select * from myAccessTable where etc.....) Is it possible to combine an SQL statement using a db2 database with the INSERT statement and an Access table for the select statement? Diane

  7. #7

    Default SQL statement INSERT INTO db2 file from an Access Table

    Mike, Thanks for the post! All is working. Diane

+ Reply to Thread

Similar Threads

  1. Insert using Micorosft Access 2000
    By S.Mildenberger in forum Microsoft
    Replies: 2
    Last Post: 06-03-2003, 11:57 PM
  2. Needed SQL Example: Insert records into db2 blob capable file
    By bgriffin@rtvanderbilt.com in forum Programming
    Replies: 0
    Last Post: 11-12-2001, 11:43 AM
  3. CREATE TABLE statement from AS/400 PF?
    By Guest.Visitor in forum IBM i (OS/400, i5/OS)
    Replies: 3
    Last Post: 06-20-2001, 10:39 AM
  4. Insert statement
    By Guest.Visitor in forum Programming
    Replies: 3
    Last Post: 12-19-2000, 06:45 AM
  5. Insert Into and Delete in same statement
    By Guest.Visitor in forum Programming
    Replies: 2
    Last Post: 02-03-2000, 03:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts