+ Reply to Thread
Results 1 to 2 of 2

Replace SQL Table with Excel data

  1. #1
    Ken Valenti
    Guest

    Replace SQL Table with Excel data

    I have a SQL database with a table that I need to periodically replace with
    data from an Excel spreadsheet.

    I wrote a proceedure using ADO to delete each record one by one - then
    adding each record one by one, but it takes forever.

    Is there a better way to do this?

  2. #2
    Dave Patrick
    Guest

    Re: Replace SQL Table with Excel data

    The delete is easy. Actually I'd probably do it all from the server using
    DTS Some ideas here. http://www.sqldts.com/

    Dim strCnn As String
    strCnn = "Provider=SQLOLEDB.1;" _
    & "Integrated Security=SSPI;" _
    & "Persist Security Info=False;" _
    & "Initial Catalog=East_Intermediate;Data Source=pe1600"
    Dim cnn As ADODB.Connection
    Set cnn = New ADODB.Connection
    cnn.Open strCnn
    cnn.Execute "DELETE FROM Table_1"
    cnn.Close

    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "Ken Valenti" wrote:
    |I have a SQL database with a table that I need to periodically replace with
    | data from an Excel spreadsheet.
    |
    | I wrote a proceedure using ADO to delete each record one by one - then
    | adding each record one by one, but it takes forever.
    |
    | Is there a better way to do this?



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1