zoukankan      html  css  js  c++  java
  • SQL Server远程连接操作

    -- 开启远程选项
    exec sp_configure 'show advanced options',1
    reconfigure
    exec sp_configure 'Ad Hoc Distributed Queries',1
    reconfigure
    
    
    -- 方法1:
    SELECT top 5 * FROM OPENDATASOURCE('SQLOLEDB','Data Source=192.168.2.208;User ID=sa;Password=ccpg@2015').[CCPG_PM].dbo.[COM_UserInfo] P where p.[GC_Flag]=0
    
    -- 方法2:
    SELECT top 5 * FROM OPENROWSET('SQLNCLI','192.168.2.208';'sa';'ccpg@2015','select * from [CCPG_PM].dbo.[COM_UserInfo] P where p.[GC_Flag]=0') AS a
    
    
    -- 关闭远程选项
    exec sp_configure 'Ad Hoc Distributed Queries',0 
    reconfigure 
    exec sp_configure 'show advanced options',0 
    reconfigure
  • 相关阅读:
    jsp第六周作业
    jsp第三周作业
    JSP第二次作业
    软件测试课堂练习(3.4)
    10.21
    10.7
    9.30
    9.23
    第四次作业
    第七周作业
  • 原文地址:https://www.cnblogs.com/hllive/p/7067459.html
Copyright © 2011-2022 走看看