sql server 如何建立远程连接?比如我本地服务器A数据库aa表aaa,远程服务器B有数据c表d,我希望可以做到在A中做到 
select * from B.c.dbo.d insert into aa.aaa
目前对远程服务器B 只有以 windows身份认证的只读权限,没有账号和密码的那种认证方式。希望会的帮帮忙,谢谢。主要目的希望可以自动化从B中拉数据到本地,不想手工去导数据了。

解决方案 »

  1.   

    参考SELECT
        *
    INTO 表名
    FROM   OPENDATASOURCE('SQLOLEDB','Data Source=远程服务器B的Ip;Integrated Security=SSPI').[远程数据库名称].[架构].[表名] h
      

  2.   


    报错了:Msg 15281, Level 16, State 1, Line 1
    SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.