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 

        

  • 相关阅读:
    Java面试之最常见的十道面试题(超经典)
    hdu 3939(勾股+容斥)
    poj 1845 (逆元 + 约数和)
    hdu 5607 BestCoder Round #68 (矩阵快速幂)
    中国剩余定理
    Math
    (⊙o⊙)…
    lucas定理
    hdu 5600 BestCoder Round #67 (div.2)
    hdu5601 BestCoder Round #67 (div.2)
  • 原文地址:https://www.cnblogs.com/mozzie/p/5441631.html
Copyright © 2011-2022 走看看