Skip to content

Instantly share code, notes, and snippets.

@petesql
Last active March 3, 2019 22:18
Show Gist options
  • Save petesql/d8259f023bcb5573cfb86a936cd6f4d7 to your computer and use it in GitHub Desktop.
Save petesql/d8259f023bcb5573cfb86a936cd6f4d7 to your computer and use it in GitHub Desktop.
configure_linked_servers
-- Configuring Linked Servers (SQL Server).
USE [master]
GO
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql?view=sql-server-2017
EXEC master.dbo.sp_addlinkedserver
@server = N'PETE-PC',
@srvproduct=N'SQL Server'
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-serveroption-transact-sql?view=sql-server-2017
EXEC master.dbo.sp_serveroption
@server=N'PETE-PC',
@optname=N'connect timeout', @optvalue=N'0'
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addlinkedsrvlogin-transact-sql?view=sql-server-2017
EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname = N'PETE-PC',
@locallogin = NULL ,
@useself = N'False',
@rmtuser = N'linked_login',
@rmtpassword = N'epae2!"mdm!'
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment