Cannot create an instance of OLE DB provider Microsoft.Jet.OLEDB.4.0 for linked server null

前端 未结 4 1184
有刺的猬
有刺的猬 2020-11-29 01:44

I am trying to export from my Table data into Excel through T-SQL query. After little research I came up with this

IN         


        
4条回答
  •  攒了一身酷
    2020-11-29 02:11

    I have MS Sql server 2012, and Office 2013. This seems to be very finicky, so you may have to adjust to your particular versions.

    1. Download the Microsoft.ACE.OLEDB.12.0 for Windows, 64 bit version found here: https://www.microsoft.com/en-us/download/details.aspx?id=13255
    2. Install it on your server.
    3. Check the user running SQL Server and make sure that user has access to the temp directory C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp if it's a local service account or C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp if it's a network service account.
    4. Configure 'Ad Hoc Distributed Queries' and enable the Microsoft.ACE.OLEDB files like this:

    Here's the SP_CONFIGURE commands:

    SP_CONFIGURE 'show advanced options', 1; 
    GO 
    RECONFIGURE; 
    SP_CONFIGURE 'Ad Hoc Distributed Queries', 1; 
    GO 
    RECONFIGURE; 
    EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1   
    EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParam', 1
    

    On newer SQL Server 2014 You had use 'DynamicParameters' instead of 'DynamicParam'

    EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
    

    Make sure you register msexcl40.dll like this:

    regsvr32 C:\Windows\SysWOW64\msexcl40.dll
    

提交回复
热议问题