• sql server跨服务器查询、插入


    因公司产品及客户都是使用mysql、oracle数据库,很久没有使用sql server数据库了,今天使用时已经忘记sql server跨服务器查询、插入怎么写了,以下作一下备忘记录下来,以后可能还会用到;

    --1.开启Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句:
    exec sp_configure 'show advanced options',1
    reconfigure
    exec sp_configure 'Ad Hoc Distributed Queries',1
    reconfigure

    Insert into SysLoginLog select * from openrowset('SQLOLEDB','sql服务器名';'用户名';'密码',数据库名.dbo.表名) t where t.LoginTime>'2017-01-01 00:00:000';

    --2.关闭Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句:
    exec sp_configure 'Ad Hoc Distributed Queries',0
    reconfigure
    exec sp_configure 'show advanced options',0
    reconfigure

  • 相关阅读:
    JS-07 (js的面向对象编程)
    AI SiameseFC
    phpstorm调试
    Php 编译扩展
    canvas
    AI FCN
    AI WebGL
    Python flask
    JIT 即时编译
    小程序
  • 原文地址:https://www.cnblogs.com/mininet/p/7874107.html
Copyright © 2020-2023  润新知