Click here to Skip to main content
15,881,669 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
--Scenario--

i have saved my excelsheet in my desktop and its closed

--in sql server

SQL
SP_CONFIGURE  'AD HOC DISTRIBUTED QUERIES' ,1
GO
RECONFIGURE
go

insert into temp_adhoc_arihant
(
userid,
starttime,
endtime
)
select * from 
openrowset ('MICROSOFT.JET.OLEDB.4.0','EXCEL 8.0; DATABASE=C:\Users\anurag.nayak\Desktop\sirumanual.xls','SElECT * FROM [DATA$]') 
GO

--But i am getting error
Cannot create an instance of OLE DB provider "MICROSOFT.JET.OLEDB.4.0" for linked server "(null)".

I have restarted sql server. But same error.

--How to fix it ?
Posted
Updated 25-Aug-13 21:11pm
v2
Comments
_Asif_ 26-Aug-13 7:59am    
We have no idea what actually you want?
anurag19289 26-Aug-13 11:56am    
It's simple Bro... I want to copy data from excel sheet to sql table. In excel sheet i have the same header column as per the table. Then i am executing the above commands. Hope its cleared.

But the above command is not working.
Raja Sekhar S 26-Aug-13 8:06am    
Which version of excel you are using.....?
anurag19289 26-Aug-13 11:53am    
Microsoft Office Excel 2010
Raja Sekhar S 27-Aug-13 0:56am    
I think for 2010 we have to use Microsoft.ACE.OLEDB.12.0 and Excel 12.0..Correct me if i am wrong... Check with this once...

1 solution

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