OTO

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

  a的ip是:192.168.0.1  
  b的ip是:192.168.0.2   
  a中的一个数据库为testA,表tableA 用户:sa, 密码:sa,123456

  b中的一个数据库为testB,表tableB 用户:sa, 密码:sa,123  
  
  现在要把tableB中的数据导出到tableA   
  insert into testA.dbo.db
  select * from openrowset('sqloledb','192.168.0.2';'sa';'123',testB.dbo.testB)  

  如果只导入id差异的数据:

  insert into testA.dbo.db (userId,userName,userPhoto)

  select userId,userName,userPhoto from openrowset('sqloledb','192.168.0.2';'sa';'123',testB.dbo.testB)
  where userId not in (
      select userId from testA.dbo.testA
  )  
  导入操作是要在b端执行!!!

  注意标点!!!

posted on 2009-06-04 11:13  OTO  阅读(307)  评论(0)    收藏  举报