zoukankan      html  css  js  c++  java
  • SQLServer OpenRowSet 导入数据

      今早上同事要求从SQLServer2008导出一部分数据到SQLServer2000中作为演示/测试数据,开始也没想多,直接去SQLServer2000的企业管理器中,用了数据导入的功能。以为完事了,后来有要求导入更多表,SQLServer2000中勾选表,太痛苦。干脆直接用语句写。

      truncate Table TableTest
      go
      insert into TableTest
      select * from openrowset('SQLOLEDB','Server=192.168.0.229;PWD=sa;UID=sa;','select * from TEST.dbo.TableTest') as t

      原以为很简单,在SQLServer2008中测试,一运行,报错:

         

         问了百度,这么解决:

         首先运行下边的语句:

         exec sp_configure 'show advanced options',1
         reconfigure
         exec sp_configure 'Ad Hoc Distributed Queries',1
         reconfigure

         然后执行 openrowset

         操作完了之后,再关掉上边的开关:

         exec sp_configure 'Ad Hoc Distributed Queries',0
         reconfigure
         exec sp_configure 'show advanced options',0
         reconfigure 

        

  • 相关阅读:
    img[src*="same"]{}
    a[href$=".pdf"]解释
    ::selection{}
    a[href^=""]的解释
    who are you?
    天下武功唯快不破
    登录一下好吗??
    后台登录
    实验吧—简单的登录题
    hdu 1010
  • 原文地址:https://www.cnblogs.com/mozzie/p/5441631.html
Copyright © 2011-2022 走看看