Search This Blog

Monday, February 22, 2010

Added Microsoft Access as linked server SQL Server

SQL Server > Linked Server > Add

sp_addlinkedserver

Creates a linked server. A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources

sp_addlinkedsrvlogin

Creates or updates a mapping between a login on the local instance of SQL Server and a security account on a remote server.

Example: Add Microsoft Access as linked server SQL Server
 
USE master
GO
-- To use named parameters:
EXEC sp_addlinkedserver
@server = 'ACCES',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'D:\data\DB1.mdb'
GO

-- set password
EXEC sp_addlinkedsrvlogin 'ACCES', false, 'sa', 'Admin', NULL