alter procedure sp_excelfortest as -- declare @datavar varchar(200) declare @sql varchar(500) -- set @datavar = 'Excel 8.0;DATASOURCE=' + @filname set nocount on begin --create table #temptable (Date date ,Day varchar(30),Reason varchar(100)) --set @sql = (SELECT * FROM OPENDATASOURCE('Microsoft.jet.OLEDB.4.0','+@datavar +;HDR=YES','SELECT Data,Day,Reason FROM [Sheet1$]') Set @sql ='select * FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0;Database=D:\baskarbook1.xls;HDR=YES;'', ''SELECT * FROM [Sheet1$]'')' exec (@sql) end
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Unspecified 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)".
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)