开发者

Expose Microsoft Access database over SQL Server using linked server

We have one .exe application that uses one .mdb Microsoft Access database.

I need to access data inside access file over Microsoft SQL Server. We have SQL Server 2008 R2 Enterprise that has linked server pointed to this Acces开发者_运维技巧s file and I can run select / update query using SQL statement.

SELECT * FROM [LinkedServerAccessDB]...[SomeTable]

How can I configure that this linked server, my Access database, is directly published as "Database" when some application tries to connect to my SQL Server using SQL Server instance name, and username and password. Which "database name" should I use to use directly linked server ?

Thank you


It sounds like you want your MS Access Linked Server object available as a database (i.e. available in the 'Databases' folder in SSMS). This isn't possible, directly.

Suggest you create a new SQL Server database that mimics the name of that Access database. Map a user to that login you've got above. Allow the user to run queries against the linked server.


You can use CREATE SYNONYM like so.

USE ASQLServerDB
GO

CREATE SYNONYM Sometable FOR LinkedServerAccessDB...SomeTable

Once this is done you can write SELECT [...] from SomeTable as though it was a member of the database ASQLServerDB

I was only able to get it to work at the object level so you'll need to do this for each object you want to expose. You could create an empty database that just contained these Synonyms if you wanted to get that "published as a database" feel.

 --This doesn't work
CREATE SYNONYM Sometable FOR LinkedServerAccessDB...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜