目前我正在从事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可以执行以下操作:
-
Click Start,click All Programs,click Microsoft SQL Server 2005 or Microsoft SQL Server 2008,and then click SQL Server Management Studio.
-
In the Connect to Server dialog box,specify the name of the appropriate SQL Server,and then click Connect.
-
In SQL Server Management Studio,double-click Server Objects,right-click Linked Servers,and then click New Linked Server.
-
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.
-
Under Server type,click SQL Server.
-
In the left pane of the New Linked Server dialog,under Select a page,choose Security.
-
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.
-
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.
-
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';
任一版本都将设置链接服务器,然后您可以在代码中引用该服务器. (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|