SQLTeam.com | Weblogs | Forums

Trying to import Excel data to SQL server (through code only)

I am trying to run the following script, which is all over the Net, but does not seem to work.
I have tryed this on a number of computers and I get one error after another. I would research this and run a sujested fix and get another.
I am not getting this erro on two of my computers:
Msg 7438, Level 16, State 1, Line 1
The 32-bit OLE DB provider "Microsoft.ACE.OLEDB.12.0" cannot be loaded in-process on a 64-bit SQL Server.
However I canot find a fix.
Can someone tell me a fix or another way (through code) to omport an Excel file to SQL server.

Here is the code that I am using:

INSERT INTO players select * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\Import\Players.xlsx;HDR=YES', 'SELECT * FROM [Sheet1$]')

Thank you

how are you running this? from ssms, from a sql job? ....

I am running it in ssms

This tells you the error. You need to install the 64-bit version of this driver on the server

well that is what I kind of thought but I cannot find anything on it. Where would I gt this from?