VBA: SQLBulkCopy

  • Thread starter Thread starter Marc Seitz
  • Start date Start date
M

Marc Seitz

Hi!

I´m new to SQL and VBA.

I´m trying the following:
I got an Excel-Table (large) which I want to transfer into an SQL2005 table.

I have to use Excel-VBA.
Via Google I found out there is a command like "sqlbulkcopy".
Can anyone give me a hint how to use this?

First, I declare my connection variables and then open the Connection
(ADOB.Connection).

But how do I handle the SQLBulkCopy in there?
Can you please give a small code sample?

In the end, I close the connection.

Thanks a lot.

Marc
 
I wrote an article some time ago on this
http://www.developer.com/db/article.php/3702826 but the trick (in any case)
is to create a DataReader stream that accesses the source rowset. This
example accesses rows from a flat delimited file, but I expect without much
trouble you'll discover a .NET, ODBC or OLE DB driver for Excel that can
expose the rows.

hth
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
Back
Top