![]() |
Export Data from Excel to SQL
I am trying to export a large about of data from excel to sql, this
doesn't seem to work, any suggestion. I tried doing it one line at a time but it was very slow. Sub test_database_export() Dim db As database Dim sqlstring1 As String Dim data() As Variant data() = Range("A2:D18933").Value Application.ScreenUpdating = False Set db = OpenDatabase("", True, False, "ODBC;DSN=sqlserver;uid=xxx;pwd=xxx") sqlstring1 = "INSERT INTO [Sheet3$] (Scenario,Period,Block,Price) VALUES " & data() & ")" db.Execute (sqlstring1) db.Close Set db = Nothing Application.ScreenUpdating = True End Sub Thanks in adavance. German |
All times are GMT +1. The time now is 01:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com