Click here to Skip to main content
15,888,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i try to import ms excel to sql server table this msg will come... i want to import data from ms excel sheet to sql server table


Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"
Posted
Updated 3-Dec-13 22:54pm
v2
Comments
Richard MacCutchan 4-Dec-13 4:46am    
Looks like your connection string contains an invalid reference. Please add the detail to your question.

See a good article about this:

Excel Import to SQL Server using Linked Servers[^]

You may find configuration steps that depend on SQL Server and Excel platforms.
 
Share this answer
 
Use this..
SQL
Exec sp_configure 'show advanced options', 1;
RECONFIGURE;
GO

Exec sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1; 
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1;
GO

Insert into OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0','Data Source=C:\upload_test.xlsx;Extended Properties=Excel 12.0')...[Sheet1$]
SELECT ColumnNames FROM Your_table -- Sheet Should be already Present along with headers

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 0;
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 0;
GO

Exec sp_configure 'Ad Hoc Distributed Queries', 0;
RECONFIGURE;
GO

Exec sp_configure 'show advanced options', 0
RECONFIGURE;
GO
 
Share this answer
 
up vote
0
down vote
Close SQL Server Management Studio. Type Services.msc in the run command to open the services window.

Search for SQL Server Service and right click it and select properties.

In the Log On Tab, select system account/or select your domain ID and Account and password.

Once it finds your login name press OK.

Now type your login’s passwords in both the fields.

Restart the services so that the new changes are applied as shown in figure below.

Now start SQL Server Management Studio and try to run the query if still not working try a system restart.

or execute the query.

USE [master] GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1 GO
 
Share this answer
 
Comments
Ayanda Lokwe 31-Aug-21 10:57am    
Thank you very much, solution 4 worked for me, thanks a lot. I struggle for weeks and weeks trying to fix this.
I have simply enter in SQL Management Studio as Administrator and the SELECT statement run well,

In fact both of them:

SELECT * FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0',
--'Data Source=C:\xxx.accdb;Persist Security Info=False;')...nTypeQuantity ;

SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0';,
'C:\xxx.accdb';'admin';''
,nTypeQuantity);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900