Linked Server
———————————————————
Create Linked Server through Scripts
———————————————————
USE [master]
GO
EXEC sp_addlinkedserver
@server=’dsql2k’,
@srvproduct=”,
@provider=’SQLNCLI’,
@datasrc=’source_name’
GO
USE [master]
GO
EXEC master.dbo.sp_serveroption @server=N’dsql2k’, @optname=N’rpc’, @optvalue=N’true’
GO
EXEC master.dbo.sp_serveroption @server=N’dsql2k’, @optname=N’rpc out’, @optvalue=N’true’
GO
select * from master.dbo.sysservers
—————————————————————————
Alternative Script to Create Linked Server and Mapping of Users
—————————————————————————
Use Master
go
EXEC master.dbo.sp_addlinkedserver @server = N’dsql2k’, @srvproduct=N”, @provider=N’SQLOLEDB’, @datasrc=N’testserver’
GO
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N’dsql2k’, @locallogin = N’sa’, @useself = N’False’, @rmtuser = N’sa’, @rmtpassword = N’sa’
GO
Pingback: SQL Server – Linked Server – Mapped all users with one statement « IT-Articles