Hi friends
This is my query for getting dyanamic excel file to sql
create procedure sp_excelforgeneralholidays(@filname nvarchar(max))
as
declare @datavar varchar(200)
declare @sql varchar(500)
set @datavar = 'Excel 8.0;DATABASE=' + @filname
set nocount on
begin
set @sql = 'SELECT * FROM OPENROWSET(''Microsoft.jet.OLEDB.4.0'','''+@datavar +''', ''SELECT Data,Day,Reason FROM [Sheet1$]'')'
exec (@sql)
end
and This is the execution process
exec sp_excelforgeneralholidays 'D:\baskaran\\baskarbook1'
this is my excel file
My table field is
Holidayid Date Day Reason createddatetime updateddatetime adminid
The error is
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.jet.OLEDB.4.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.jet.OLEDB.4.0" for linked server "(null)".
i dont know how to solve this error.please help me