在链接的MySQL服务器中查询

时间:2018-06-22 11:25:40

标签: mysql sql-server ssis ssis-2012 ssis-2008

嗨,我已经将我的MYSQL服务器(172.xx.xx.xx)链接到了我的sql服务器。但是在使用查询时会提供错误。

select * from OPENQUERY ([MYSQL],'select * from example.address_table limit 10')

此查询工作正常,但是在执行以下查询时却出现以下错误:-

select * from OPENQUERY ([MYSQL],'select * from example.address_table
where (create_date between '2015-01-01 00:00:00' and '2015-01-31 23:59:59') or 
(modified_date between '2015-01-01 00:00:00' and '2015-01-31 23:59:59');

如何解决链接服务器中的查询。

这是错误

  

字符串')后的右引号

1 个答案:

答案 0 :(得分:0)

鉴于您的错误,这应该是解决方法

select * from OPENQUERY ([MYSQL],'select * from example.address_table 
where (create_date between ''2015-01-01 00:00:00'' and ''2015-01-31 23:59:59'') or 
(modified_date between ''2015-01-01 00:00:00'' and ''2015-01-31 23:59:59'')');