- Install Microsoft Access Database Engine 2010 64bit and Service Pack 1 for Microsoft Access Database Engine 2010 64bit
- Run this SQL command
exec master..xp_enum_oledb_providers
In result you will see "Microsoft.ACE.OLEDB.12.0" - Set SQL Server parameter "ad hoc distributed queries" to 1 with this script
sp_configure 'show advanced options', 1;
go
reconfigure;
go
sp_configure 'Ad Hoc Distributed Queries', 1;
go
reconfigure;
goYou can read about parameter "ad hoc distributed queries" in this article ad hoc distributed queries Server Configuration Option - If you get an error "Ad hoc update to system catalogs is not supported." run this SQL command
sp_configure 'allow updates', 0;
go
reconfigure;
go - Set options "AllowInProcess" and "DynamicParameters" for Microsoft.ACE.OLEDB.12.0
provider to 1. Run this SQL script
use [master]
go
exec master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1
go
exec master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1
go - MDB file should be in local folder in SQL Server.
- After all you can use this SQL command like this
SELECT CustomerID, CompanyNameFROM OPENROWSET('Microsoft.Ace.OLEDB.12.0','C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb';'admin';'',Customers)
Tuesday, November 27, 2012
How-to access to Acces or Excel file from MS SQL Server 64bit
Subscribe to:
Posts (Atom)