473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied

Trying to open a SQL Server query but am getting this message:

Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server.

Heres the script:

Expand|Select|Wrap|Line Numbers
  1. Insert into OpenDataSource( 
  2.     'Microsoft.Jet.OLEDB.4.0',
  3.       'Data Source="H:\Imran\Capacity Planning 0708\UHL Spells Apr 05 to Sept 07 TEST.xls";
  4.     Extended properties=Excel 5.0')...[PivotSh$]
  5. (Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month, Qtr,
  6.     Description_Contract, Activity_Type_Grouped, Sum_of_Spells)
  7.  
  8. Select    Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month,
  9.     Case    When Financial_Month between '1' and '3' Then 'Qtr 1'
  10.         When Financial_Month between '4' and '6' Then 'Qtr 2'
  11.         When Financial_Month between '7' and '9' Then 'Qtr 3'
  12.         When Financial_Month between '10' and '12' Then 'Qtr 4' Else '' End as Qtr,
  13.     Description_Contract,
  14.     Case    When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
  15.         Else Activity_Type End as Activity_Type_Grouped,
  16.     SUM(Total_Spells) as Sum_of_Spells
  17.  
  18. From    [Busobjects].Capacity_Planning.dbo.tbl_BaseLine_UHL_Spells_Trend_0708 a
  19.  
  20. Inner     Join OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
  21.               'Data Source="H:\Imran\Capacity Planning 0708\UHL Spells Apr 05 to Sept 07 TEST.xls";
  22.             Extended properties=Excel 5.0')...[SPECIALTY TREND by Month$] as PR
  23.      On PR.P1 = Commissioner_Code 
  24.     AND PR.P2 = LSS_Flag
  25.     AND PR.P3 = Description_Contract
  26.     AND PR.P4 = (Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
  27.     Else Activity_Type END)
  28.  
  29.  
  30. Left    Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_Specialty_UHL b
  31.     on a.Specialty_Code = b.Code
  32.  
  33. Left    Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_IP_SpecServ_0708 c
  34.     on a.Specialised_Services_Code = c.SpecServ
  35.  
  36. Left    Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_IP_HRG_Tariff_0708 d
  37.     on a.HRG_Code = d.HRGCode
  38.  
  39. Group    by Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month,
  40.     Case    When Financial_Month between '1' and '3' Then 'Qtr 1'
  41.         When Financial_Month between '4' and '6' Then 'Qtr 2'
  42.         When Financial_Month between '7' and '9' Then 'Qtr 3'
  43.         When Financial_Month between '10' and '12' Then 'Qtr 4' Else '' End,
  44.     /*Specialty_Code,*/ Description_Contract, --Activity_Type,
  45.     Case    When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
  46.         Else Activity_Type End--, HRG_Code + ': '+ d.HRGDesc,
  47.     --Specialised_Services_Code + ': '+c.Description
Nov 21 '07 #1
2 17327
deepuv04
227 Expert 100+
Try the following query to read the data from excel sheet

Expand|Select|Wrap|Line Numbers
  1.     sp_configure 'show advanced options', 1
  2.     RECONFIGURE
  3.     GO
  4.     sp_configure 'Ad Hoc Distributed Queries', 1
  5.     RECONFIGURE
  6.     GO
  7.  
  8. SELECT * 
  9. FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
  10.                 'Excel 8.0;Database=C:\Documents and Settings\Administrator\Desktop\rolemenu.xls',
  11.                 'SELECT * FROM [Sheet1$] where MenuItemId is not null')
make sure your excelsheet is on server...

for more information visit the following link

** Edit **
Removed link to competing forum site. Please check out our FAQ.
Nov 22 '07 #2
If i run the OpenRowSet Query under sysadmin role it is working perfectly. But if the same query running under public role, then it is not working. It is giving following message like "Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied". I am trying to use least privilage account for my application. Do we need sysadmin role to run OpenRowSet query? Kindly help me out to resolve the Issue. Thanks in advance
Sep 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
1
by: Mahesh Hardikar | last post by:
Hi , I have been trying to connect to access database from SQL Server 7.0. This machine is having 7.0 as a default instance and 2000 as a named instance. Also the machine doesn't have access...
0
by: Jim Andersen | last post by:
Hope this helps someone. SQL server 2000. I imported some text into a table. "insert into tbltst (field1, field2) SELECT field1, field2 FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data...
2
by: Randy | last post by:
I am trying to relink some Oracle tables in an Access database via VB.NET and ADOX. I receive the following error when executing the cat.ActiveConnection link "Arguments are of the wrong type,...
6
by: Ben | last post by:
I am trying to migrate my vb6.0 over to vb.net. Here is the error that that I am stuck with: Public myDB As DAO.Database ..... path = System.IO.Path.GetFullPath("..") myDB =...
5
by: somersbar | last post by:
hello all, im trying to connect to a microsoft access database from an ASP.NET web form. i keep getting the following error though: ERROR Could not use '(unknown)'; file already in use....
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
24
by: dancer | last post by:
Using ASP.net 1.1 and Microsoft Access. I received the following error message. Why? I have closed the Access file. I have another very small access file that opens with no trouble with the...
1
by: dellis | last post by:
Problem: My project was initially created without putting passwords in the connection string. When I added the password in the connection string, it disappears when performing a database fill. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.