Can anyone point me to an example for exporting an excel table into an sql table, assuming the same structure, using VBA? I'm using Excel 2007. I've seen examples that read the data one row at a time and either run one insert per row, or build their recordset, and do UpdateBatch. Is there a way where I can select all record from the source table in excel and insert them all into the target sql table?
Asked
Active
Viewed 3,406 times
1 Answers
0
Bulk Insert is what you are looking for.
Try these: Stackoverflow question
Other way is to import in sql management studio Import Excel spreadsheet columns into SQL Server database
-
Thanks, but I can't seem to find an example for using bulk insert from the Excel workbook itself (using VBA). – Lukasz Mar 31 '15 at 15:08
-
You write the sql bulk insert and connection string in your VBA program.The easiest way I've found is to import the excel or txt file from sql management – durbo Apr 04 '15 at 04:25