Results 1 to 5 of 5
  1. #1
    SteveApa is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    84

    Fastest Method to Push Local Access Table to SQL Server table.


    Hi All.
    What is the fastest method to push a local access table to an sql server table. I am programming this application for global users. I tried looping thru each recordset (code below) and also tried a local access append query to a linked sql server table. Both methods seem to run at the same speed - slow. For the VBA method, I looped thru with a DAO local recordset and ado sql server recordset. Both tables have the same record fields.
    Code:
        'progress bar
    SysCmd acSysCmdInitMeter, "Writing to Server...", rs_dao.RecordCount
        j = 1
        While Not rs_dao.EOF
            rs_ado.AddNew
            For i = 0 To rs_ado.Fields.Count - 1
                Select Case rs_ado(i).name
                Case "ElementID"
                    'do nothing this is a auto number / primary key created on sql server
                Case "Publish Date"
                    rs_ado(i) = Now()
                Case Else
                    rs_ado(i) = rs_dao(rs_ado(i).name)
                End Select
            Next i
            rs_dao.MoveNext
            j = j + 1
            If j Mod 10 = 0 Then
    SysCmd acSysCmdUpdateMeter, j
                DoEvents
            End If
        Wend
    SysCmd acSysCmdRemoveMeter
        rs_ado.UpdateBatch
        rs_dao.Close
        Set rs_dao = Nothing
            
        rs_ado.Close
        Set rs_ado = Nothing
    Thanks for the help.
    Steve
    Harrisburg, PA

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    put the table, or the data?
    if data , run an update query. (not using vb to cycle thru records 1 at a time)
    if table design, you must enter sql manager and design from scratch.

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    If you mean copy data from Access > SQL then an update or append query is the fastest way, but it will be slow over a WAN if you are doing 1000's of records.
    If there are a lot of indexes on the destination table, it may be quicker to write to a temporary empty SQL table with no indexes then call an SP to update from that to the main table?

    Certainly as Ranman has stated, looping one record at a time will definitely be really slow.

    Is this a one off or continuous process?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Answering your question literally, you can't push an access table to SQL Server
    You need to create the table in SQL Server either in SSMS or using VBA code in Access then transfer the data using an INSERT (append) query.
    If the SQL table already exists, use either an update or append query as appropriate.

    BUT if the SQL table does already exists, make it a linked table in Access so that records can be added/edited directly from Access
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,043
    Fasted method: design a SSIS package or use the import wizzard in SQL server, never ever use RBAR (Row By Agonizing Row). If the import needs to be done on a regular base, you can add the package to a SQL job.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Best,cheapest and fastest method to share database
    By kinneretaccess in forum Access
    Replies: 10
    Last Post: 04-09-2018, 06:51 AM
  2. Replies: 2
    Last Post: 03-30-2018, 11:33 AM
  3. Replies: 5
    Last Post: 09-13-2016, 12:08 PM
  4. create local table from sql server table
    By SteveApa in forum SQL Server
    Replies: 11
    Last Post: 09-12-2016, 10:18 AM
  5. sql server query to local table
    By SteveApa in forum SQL Server
    Replies: 3
    Last Post: 09-08-2016, 01:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums