Consulting

Results 1 to 2 of 2

Thread: Import from CSV to a SQL table on a remote server using VBA Access

  1. #1
    VBAX Newbie
    Joined
    Jun 2019
    Posts
    1
    Location

    Import from CSV to a SQL table on a remote server using VBA Access

    Hello All,


    We are migrating to Access 2013 from 2010 and from SQL 2008 to 2016. To import a CSV file, I used the Docmd.TransferText command and that did the import easily as it was to a local access table.


    Now I have issues when trying to import the data from CSV to a remote SQL table. I copied the file to the SQL server box where the 2016 database is and used the below for the transfer.


    str1 = "BULK INSERT Temp3 " & _
    "FROM 'C:\Bulk\FileExchange_Response_49636101_49.csv'" & _
    "WITH (FIRSTROW = 2, FIELDTERMINATOR = ',', " & _
    "ROWTERMINATOR = '\\n', TABLOCK)".


    This does not throw any error however, does not import the data.




    Could anyone please shed any ideas to import the data from the CSV.


    Thanks

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Can't you import the csv file in to an Access table first and then transfer it to the SQL table?

Tags for this Thread

Posting Permissions

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