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: - Insert into OpenDataSource(
-
'Microsoft.Jet.OLEDB.4.0',
-
'Data Source="H:\Imran\Capacity Planning 0708\UHL Spells Apr 05 to Sept 07 TEST.xls";
-
Extended properties=Excel 5.0')...[PivotSh$]
-
(Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month, Qtr,
-
Description_Contract, Activity_Type_Grouped, Sum_of_Spells)
-
-
Select Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month,
-
Case When Financial_Month between '1' and '3' Then 'Qtr 1'
-
When Financial_Month between '4' and '6' Then 'Qtr 2'
-
When Financial_Month between '7' and '9' Then 'Qtr 3'
-
When Financial_Month between '10' and '12' Then 'Qtr 4' Else '' End as Qtr,
-
Description_Contract,
-
Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
-
Else Activity_Type End as Activity_Type_Grouped,
-
SUM(Total_Spells) as Sum_of_Spells
-
-
From [Busobjects].Capacity_Planning.dbo.tbl_BaseLine_UHL_Spells_Trend_0708 a
-
-
Inner Join OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
-
'Data Source="H:\Imran\Capacity Planning 0708\UHL Spells Apr 05 to Sept 07 TEST.xls";
-
Extended properties=Excel 5.0')...[SPECIALTY TREND by Month$] as PR
-
On PR.P1 = Commissioner_Code
-
AND PR.P2 = LSS_Flag
-
AND PR.P3 = Description_Contract
-
AND PR.P4 = (Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
-
Else Activity_Type END)
-
-
-
Left Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_Specialty_UHL b
-
on a.Specialty_Code = b.Code
-
-
Left Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_IP_SpecServ_0708 c
-
on a.Specialised_Services_Code = c.SpecServ
-
-
Left Outer Join [Busobjects].Capacity_Planning.dbo.tbl_Refs_IP_HRG_Tariff_0708 d
-
on a.HRG_Code = d.HRGCode
-
-
Group by Provider_Code, Commissioner_Code, LSS_Flag, Financial_Year, Financial_Month,
-
Case When Financial_Month between '1' and '3' Then 'Qtr 1'
-
When Financial_Month between '4' and '6' Then 'Qtr 2'
-
When Financial_Month between '7' and '9' Then 'Qtr 3'
-
When Financial_Month between '10' and '12' Then 'Qtr 4' Else '' End,
-
/*Specialty_Code,*/ Description_Contract, --Activity_Type,
-
Case When Activity_Type in ('Emergency','Non-elective') Then 'Non-Elective'
-
Else Activity_Type End--, HRG_Code + ': '+ d.HRGDesc,
-
--Specialised_Services_Code + ': '+c.Description
2 17327
Try the following query to read the data from excel sheet - sp_configure 'show advanced options', 1
-
RECONFIGURE
-
GO
-
sp_configure 'Ad Hoc Distributed Queries', 1
-
RECONFIGURE
-
GO
-
-
SELECT *
-
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
-
'Excel 8.0;Database=C:\Documents and Settings\Administrator\Desktop\rolemenu.xls',
-
'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.
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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,...
|
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 =...
|
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....
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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
|
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...
| |