USE [master]
GO
/****** Object: LinkedServer [链接名称] Script Date: 2024/6/6 9:09:53 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'链接名称', @srvproduct=N'MSSQL', @provider=N'SQLNCLI', @datasrc=N'远程数据库'
/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'链接名称',@useself=N'False',@locallogin=NULL,@rmtuser=N'用户名',@rmtpassword='密码'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'rpc', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'rpc out', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'collation name', @optvalue=NULL
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'链接名称', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO
标签:dbo,EXEC,数据库,sp,sqlserver,linkedserver,server,master,GO From: https://www.cnblogs.com/qq505610307/p/18234409