Click here to Skip to main content
15,902,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got error like this
Invalid object name 'Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\ezacc\DATA\accountdata.mdb.ClientAc'.

while executing this query in sql server
SQL
select * into [ACTYPE] from [Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\ezacc\DATA\accountdata.mdb].[ClientAc]

Would u pls resolve this error


I have tried still it is getting same error

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

Would u please elaborate ad-hoc queries in a stepwise
Posted
Updated 29-Jul-15 2:53am
v4
Comments
[no name] 29-Jul-15 8:13am    
Fix your query and the problem will resolve itself.

In order to query Access database from SQL Server you need to use OPENROWSET or similar function or define the Access db as a linked server.

Have a look at OPENROWSET (Transact-SQL)[^].

Also ensure that you have allowed distributed ad-hoc queries as explained in ad hoc distributed queries Server Configuration Option[^]
 
Share this answer
 
v2
Comments
TarunKumarSusarapu 29-Jul-15 8:52am    
I have tried still it is getting same error

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

Would u please elaborate ad-hoc queries in a stepwise
Wendelius 29-Jul-15 9:14am    
Your query is called a distributed ad-hoc query. Please go through the documentation links I provided.
Your SQL totally wrong - syntactically...
To open an external source ad-hoc, you should use OPENROWSET in your SELECT query...
SQL
SELECT * INTO [ACTYPE] FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\ezacc\DATA\accountdata.mdb',ClientAc)

For more details and options read here: https://msdn.microsoft.com/en-us/library/ms190312.aspx[^]
 
Share this answer
 
Comments
TarunKumarSusarapu 29-Jul-15 8:47am    
I got error like this

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

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