USE [master]
GO
/****** Object: LinkedServer [SQL01] Script Date: 2020/4/9 11:51:17 ******/
EXEC master.dbo.sp_addlinkedserver @server = N‘SQL01‘, @srvproduct=N‘‘, @provider=N‘SQLNCLI‘, @datasrc=N‘域名或者IP‘
/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N‘SQL01‘,@useself=N‘False‘,@locallogin=NULL,@rmtuser=N‘账户‘,@rmtpassword=‘密码明文‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘collation compatible‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘data access‘, @optvalue=N‘true‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘dist‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘pub‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘rpc‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘rpc out‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘sub‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘connect timeout‘, @optvalue=N‘0‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘collation name‘, @optvalue=NULL
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘lazy schema validation‘, @optvalue=N‘false‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘query timeout‘, @optvalue=N‘0‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘use remote collation‘, @optvalue=N‘true‘
GO
EXEC master.dbo.sp_serveroption @server=N‘SQL01‘, @optname=N‘remote proc transaction promotion‘, @optvalue=N‘true‘
GO
原文地址:https://www.cnblogs.com/hualiuliu/p/12665909.html