Search code examples
mysqlsql-serverssisssis-2012ssis-2008

Query in Linked Mysql server


Hi i have linked my MYSQL server (172.xx.xx.xx) to my sql server . but while useing the query its providing the error.

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

this query is working fine but while executing the below query its through the error:-

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');

how to solve the query in linked server.

this is the error

Unclosed quotation mark after the character string ')


Solution

  • As given your error this should be the fix

    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'')');