加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – 如何为SQL Server 2008创建链接服务器,其中有2000

发布时间:2020-12-12 08:52:49 所属栏目:MsSql教程 来源:网络整理
导读:目前我正在从事SQL Server 2000,2005 2008年,我的要求是, 数据库可用于SQL Server 2000 2005年将在2008年使用链接服务器. 假设我在SQL Server 2000中有一个名为LIVE_2000的数据库,在SQL Server 2005中称为LIVE_2005,有人可以帮助我将LIVE_2000和LIVE_2005的链
目前我正在从事SQL Server 2000,2005& 2008年,我的要求是,
数据库可用于SQL Server 2000& 2005年将在2008年使用链接服务器.

假设我在SQL Server 2000中有一个名为LIVE_2000的数据库,在SQL Server 2005中称为LIVE_2005,有人可以帮助我将LIVE_2000和LIVE_2005的链接服务器创建到SQL Server 2008中?

第一件事是甚么可能的?

提前感谢…

解决方法

有一个 few different ways可以在SQL Server中创建一个链接的服务器,您可以使用SQL Server Management Studio中的GUI或通过脚本.

使用instructions on MSDN可以执行以下操作:

  1. Click Start,click All Programs,click Microsoft SQL Server 2005 or Microsoft SQL Server 2008,and then click SQL Server Management Studio.

  2. In the Connect to Server dialog box,specify the name of the appropriate SQL Server,and then click Connect.

  3. In SQL Server Management Studio,double-click Server Objects,right-click Linked Servers,and then click New Linked Server.

  4. In the New Linked Server dialog box,on the General page,in Linked server,enter the full network name of the SQL Serveryou want to link to.

  5. Under Server type,click SQL Server.

  6. In the left pane of the New Linked Server dialog,under Select a page,choose Security.

  7. You will need to map a local server login to a remote server login. On the right side of the Security page,click the Add button.

  8. Under Local Login,select a local login account to connect to the remote server. Check Impersonate if the local login also exists on the remote server. Alternatively,if the local login will be mapped to a remote SQL Server login you must supply the Remote User name and Remote Password for the remote server login.

  9. In the left pane of the New Linked Server dialog,choose Server Options. Set the Rpc and Rpc Out parameters to True,and then click OK.

另一种方法是使用Transact SQL编写查询以使用存储过程sp_addlinkedserver设置服务器

EXEC sp_addlinkedserver   
   @server='yourServer',@srvproduct='',@provider='SQLNCLI',@datasrc='yourServerinstance1';

任一版本都将设置链接服务器,然后您可以在代码中引用该服务器.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读