Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SELECT * FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0', 'Data Source=\\192.168.11.32\mdb\USERINFO.mdb')...[USERINFO]
Posted
Updated 30-Sep-13 0:10am
v2
Comments
Member 10256268 30-Sep-13 6:05am    
i am getting this 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.
Thanks7872 30-Sep-13 6:08am    
Why you are writing whole questions in title box? You have been given enough space for it.
Member 10256268 30-Sep-13 6:10am    
but i am getting this error :Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider...

1 solution

This Code worked Fine.....
To check the driver is installed or not open ODBC Data Source Administrator (Start > Run > type - ODBCAD32.EXE and hit enter) and check under the Drivers tab
SQL
SET NOCOUNT ON;

Exec sp_configure 'show advanced options', 1;
RECONFIGURE;
GO

Exec sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

SELECT ID,FirstName,Surname 
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=C:\AddressBook.mdb')...[tblContacts]

--SELECT [Field1],[Field2],[Field3],[Field4] 
--FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=Location:\Filename.mdb')
...[TableName]

Exec sp_configure 'Ad Hoc Distributed Queries', 0;
RECONFIGURE;
GO

Exec sp_configure 'show advanced options', 0
RECONFIGURE;
GO
 
Share this answer
 
v2
Comments
Member 10256268 1-Oct-13 5:07am    
please any one can explain what the above code will do.
Raja Sekhar S 1-Oct-13 5:16am    
It will show the data present in Columns Id,FirstName,Surname From Table 'tblContacts' in AddressBook.mdb Ms-Access File Located in C: Location
Member 10256268 1-Oct-13 5:20am    
same like this i can show data which is present in mdb puls.
Member 10256268 1-Oct-13 5:20am    
same like this i can show data which is present in mdb puls.
Member 10256268 1-Oct-13 5:22am    
i want to retrieve one table from mdb plus viwer into sql serveris it possible.

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