I’ve setup a linked MySQL server on our Microsoft SQL Server. I can run this query successfully in MSSQL Management Studio…
SELECT * FROM OPENQUERY(MYSQL, 'SELECT * FROM countries')
When I run this from a website in PHP though, I get this error…
Message: Failed to query SQL statement. Reason: Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.
Any ideas what I can do to get this to work?
the workaround is to shift the “SET ANSI_WARNINGS OFF” statement just below the linked server call. And to be on the safer side apply the “SET ANSI_WARNINGS ON” statement at the end of the sp/query.
update
http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/1d501b57-fc58-4fbe-9bec-6c38ad158a62