Results 1 to 13 of 13

Thread: Experts in Recordsets , Plz Help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Experts in Recordsets , Plz Help

    How do I select an entire table and insert it in a new table which exists in a different database?


    I'm trying to export a table from ACCESS file to Oracle Table using VB recordset but I don't want to loop in a recordset , I just want to INSERT the entire table

    Is thie possible ?

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Experts in Recordsets , Plz Help

    I don't know about Oracle, but I use this code to archive records from one database to another (SQL Server 2000).

    VB Code:
    1. sql = "INSERT INTO ARCHIVE.DBO.INVENTORYHISTORYARCHIVE SELECT * FROM INVENTORYHISTORY WHERE [XACTDTE] <= " & "'" & glbDate & "'"
    2. CnxnTechSQL.Execute sql

    of course, you have to be connected to both databases before this can be executed.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: Experts in Recordsets , Plz Help

    Quote Originally Posted by Pasvorto

    VB Code:
    1. sql = "INSERT INTO ARCHIVE.DBO.INVENTORYHISTORYARCHIVE SELECT * FROM INVENTORYHISTORY WHERE [XACTDTE] <= " & "'" & glbDate & "'"
    2. CnxnTechSQL.Execute sql

    Can you please explain what is [XACTDTE] means and what is glbDate means?

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Experts in Recordsets , Plz Help

    Can't you open Access and attach the Oracle tables (don't import just attach) and create a query in Access that does the insert (if this is a one time only action)?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Experts in Recordsets , Plz Help

    XACTDTE would be a field in his database, and glbDate would be a control that contains the date he is using as the condition of the insert.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: Experts in Recordsets , Plz Help

    GaryMazzone,Can you please explain it more to me

    I opned the oracle database using ODBC connection ( I didn't import the table)

    Now what should I do ?

  7. #7
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Experts in Recordsets , Plz Help

    Are you in Access or VB?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  8. #8
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Experts in Recordsets , Plz Help

    The attached images are attaching an Oracle set of tables to Access. These are based on a Datasource build in the system.
    Attached Images Attached Images     
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: Experts in Recordsets , Plz Help

    I'm in Access right now

  10. #10
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Experts in Recordsets , Plz Help

    Select table tables to link. Then create the Query in Access as an append query from the Access table to the Oracle table.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: Experts in Recordsets , Plz Help

    Can you give me an example of the query ?

    1- I opened an oracle table using (ODBC Connection )
    2- I Imported the Access table to the current Access file.
    Now I have the two tables in the tables section

    What should I do next , go to quries and do what exactlly? use wizard ?

    I need help please be patient with me =(

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Experts in Recordsets , Plz Help

    Quote Originally Posted by bomayed
    What should I do next , go to quries and do what exactlly? use wizard ?
    Yes. Select New, Design View, select the Access table, Close.

    Select Query Type (the icon with the 2 tables), Append Query.

    Select the Oracle table.

    Drag the fields from the Access table to the Field row (1 to a box) and select the Oracle field in Append To.

    When you have all the fields you want to insert, click on the ! (run the query).

    (I think I got all the steps.)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: Experts in Recordsets , Plz Help

    Wow , Amazing , Thanks Al42 and thank you GaryMazzone

    I tried to copy the data from the access table and paste it to the oracle table in ACCESS but it took forever . . days to copy half the data. But with the append and query stuff It took 15 minutes! I wonder what's the difference between copy and paste and append . . . I mean why is it faster?

Posting Permissions

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



Click Here to Expand Forum to Full Width