我在Microsoft SQL Server上设置了链接的MySQL服务器。我可以在MSSQL Management Studio中成功运行此查询...
SELECT * FROM OPENQUERY(MYSQL, 'SELECT * FROM countries')
当我从PHP网站运行时,我收到此错误...
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.
我有什么想法可以让它发挥作用?
答案 0 :(得分:2)
解决方法是在链接服务器调用下方移动“SET ANSI_WARNINGS OFF”语句。为了更安全,在sp / query的末尾应用“SET ANSI_WARNINGS ON”语句。
<强>更新强>
SET ANSI_WARNINGS ON
SET ANSI_NULLS ON
SELECT * FROM OPENQUERY(MYSQL, 'SELECT * FROM countries')