首页 > 数据库技术 > 详细

建立SQL链接服务器

时间:2018-02-09 12:36:16      阅读:280      评论:0      收藏:0      [点我收藏+]

  

  有一个最简单的方法就是直接鼠标新建,这样是以ip为开头的,也可以通过下面的代码进行创建,这样的话就可以换名字了。。。。。。

@server名字全部改为你的链接服务器名字,@datasec改为链接服务器实例名,@rmtpassword改为登陆密码,完事~

USE [master]
GO

/****** Object:  LinkedServer [IPDYH]    Script Date: 2018/2/9 9:11:53 ******/
EXEC master.dbo.sp_addlinkedserver @server = NIPDYH, @srvproduct=N , @provider=NSQLNCLI, @datasrc=N192.168.0.16\QYDYHMSSQL
 /* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=NIPDYH,@useself=NFalse,@locallogin=NULL,@rmtuser=Nsa,@rmtpassword=@KTYpms123
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Ncollation compatible, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Ndata access, @optvalue=Ntrue
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Ndist, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Npub, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nrpc, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nrpc out, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nsub, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nconnect timeout, @optvalue=N0
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Ncollation name, @optvalue=null
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nlazy schema validation, @optvalue=Nfalse
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nquery timeout, @optvalue=N0
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nuse remote collation, @optvalue=Ntrue
GO

EXEC master.dbo.sp_serveroption @server=NIPDYH, @optname=Nremote proc transaction promotion, @optvalue=Ntrue
GO

 

建立SQL链接服务器

原文:https://www.cnblogs.com/yunquan/p/8434628.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!