OLEDB Engine - Throws error

Lance James 366 Reputation points

Trying to convert Excel Import actions in a C# program using DataTables, to using T-SQL so all processing is on the server side.



SELECT * INTO Data_dq  
    'Excel 12.0; Database=\\Server1\ExcelFileToImport.xlsx', [Sheet1$]);  

I have tried both OLEDB.16.0 & OLEDB.12.0 but can't get past these errors.

Msg 7403, Level 16, State 1, Line 1  
The OLE DB provider "Microsoft.ACE.OLEDB.16.0" has not been registered.  
Msg 7403, Level 16, State 1, Line 6  
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" has not been registered.  

Engine16.0 is installed and 12.0 cannot be installed concurrently. The attempt to do so throws and installation error.

There is a lot of chatter on the internet for this error but it always comes down to installing the 12.0. This is not an option so am I out of luck?

I also found this and applied:

sp_configure 'show advanced options', 1;  
sp_configure 'Ad Hoc Distributed Queries', 1;  


A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,599 questions
{count} votes

Accepted answer
  1. Erland Sommarskog 106.6K Reputation points

    I just want to check one thing out: You have installed ACE on the same machine that SQL Server is running on, haven't you?

    I mean, if SQL Server runs on another machine, and you install ACE on your desktop, it is not going to work out.

6 additional answers

Sort by: Most helpful
  1. Naomi 7,366 Reputation points

    Did you try to follow steps from this blog post
    abbeycode.com/blog/2019/10/17/read-excel-file-in-sql-server-with-openrowset-or-opendatasource ?

  2. Michael Taylor 51,341 Reputation points

    The error is most likely a bitness issue. The provider you're trying to use is x86 and your app is running as x64. The quick and dirty solution is to change your app's project properties to run as x86. However you shouldn't really be using that driver anyway in my opinion if you can avoid it.

    Consider using the OpenXML SDK instead. It doesn't require that Office be installed at all. The downside is that you cannot directly move the data to SQL because it isn't an ADO.NET provider.

  3. Naomi 7,366 Reputation points

    Do you have 32bit version of this installed? https://stackoverflow.com/questions/49860479/sql-server-import-export-wizard If you don't have 32bit version, you would not be able to run this command from SSMS.

  4. Yitzhak Khabinsky 25,726 Reputation points

    Hi @Lance James ,

    (1) Please try the following query in SSMS:

    -- 0. Check what 64-bit OLEDB providers are installed  
    -- 0a. In Object Explorer: Server Objects/Linked Servers/Providers  
    EXEC master.sys.sp_MSset_oledb_prop;  

    It should show what 64-bit OLEDB providers installed, and their properties, like on a screen shot below


    (2) If you don't see at least one 64-bit ACE provider, you need to install just one of them:

    (3) You would need to adjust your T-SQL statement along the following:

    --INSERT INTO ... -- uncomment this line when you are ready  
    SELECT *  
    FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',  
     'Excel 12.0 Xml; HDR=NO;  

    (4) It is possible to install both 32-bit and 64-bit on the same machine in a quiet mode:

    AccessDatabaseEngine_X64.exe /quiet  
    0 comments No comments