Click here to Skip to main content
15,884,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends

I am using
Visual studio 2010
sql server 2008 (64 bit)
ms office 2007 (32 bit)
The following is my sql queries
ALTER procedure [dbo].[sp_excelforgeneralholidays](@filname nvarchar(max),@getdate datetime,@adminid int)
 as  
 begin
 
 declare @datavar nvarchar(max)
 declare @sql varchar(1000)
 --set @getdate=coalesce(@getdate,Getdate())
 set @datavar  = 'Excel 12.0;Database=' + @filname
 
 set nocount on
   --create table #temptable (Date date ,Day varchar(30),Reason varchar(100))
  set @sql ='insert into Generalholyday_details(Date,Day,Reason) SELECT * FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0'','''+@datavar+';HDR=YES'',''SELECT Date,Day,Reason FROM [Sheet1$]'')'
  
  
   exec (@sql)
   update Generalholyday_details set createddatetime= @getdate where createddatetime is null
   update Generalholyday_details set adminid=@adminid where adminid is null
   end

GO

the following error appears
OLE DB provider 'Microsoft.ACE.OLEDB.12.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode


I changed the following also, but still error occurs
exec sp_configure 'show advanced options', 1  
reconfigure 
 GO 
 exec sp_configure 'Ad Hoc Distributed Queries', 1 
 reconfigure 
Posted
Updated 23-Jul-13 20:12pm
v2

1 solution

 
Share this answer
 
v2
Comments
baskaran chellasamy 22-Jul-13 5:02am    
Configuration option 'Ad Hoc Distributed Queries' changed from 1 to 1. Run the RECONFIGURE statement to install.
baskaran chellasamy 22-Jul-13 5:22am    
I Configured ad-hoc distributed quires to true.but still same problem is occur.
Raja Sekhar S 22-Jul-13 5:25am    
Same error..?
Raja Sekhar S 22-Jul-13 5:54am    
Check the Updated solution and let me know....

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