openquery insert语句的问题 [英] problem with openquery insert statement

查看:108
本文介绍了openquery insert语句的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

insert into MYSQL.dbo.traffic(id,date,time,ip,resultCode,bytes,url,authuser,sitesID,usersId)
SELECT t1.id,t1.date,t1.time,t1.ip,t1.resultCode,t1.bytes,t1.url,t1.authuser,t1.sitesID,t1.usersID FROM
   OPENQUERY(MYSQL, 'SELECT * FROM mysar.traffic') T1
   INNER JOIN
   MYSQL.DBO.traffic T2 ON T1.id > T2.id





i希望将数据从mysql传输到sql server.i可以创建表并首次插入数据很好。我可以在mysql表中添加新行而不是sql server table中的现有行。我正在使用上面的查询我的行大幅增加它是15 GB但是在MYSQL中它是70MB。请建议一些解决方案



i want to transfer the data from mysql to sql server.i can create the table and insert the data for the first time is fine.how can i add the new rows in the mysql table not existing rows in the sql server table.i am using this above query i rows are drastically increase and it is 15 GB but in the MYSQL it is 70MB.Please suggest some solution

推荐答案

试试这个:



Try this:

INSERT INTO MYSQL.dbo.traffic(id,date,time,ip,resultCode,bytes,url,authuser,sitesID,usersId)
SELECT t1.id,t1.date,t1.time,t1.ip,t1.resultCode,t1.bytes,t1.url,t1.authuser,t1.sitesID,t1.usersID FROM
   OPENQUERY(MYSQL, 'SELECT * FROM mysar.traffic') T1
   LEFT OUTER JOIN MYSQL.DBO.traffic T2 
     ON T1.id = T2.id
   WHERE T1.id IS NULL -- Filter for non-existing rows


这篇关于openquery insert语句的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆