How to solve this error: 7405 16 heterogeneous queries require that the ansi_nulls and ansi_warnings options be set for the connection. This ensures consistent query semantics. Enable these options and then resend the query

Source: Internet
Author: User
Today, when I made a cross-Server query for two database servers, I encountered a Problem. "error: 7405 16 heterogeneous query requires that the ansi_nulls and ansi_warnings options be set for the connection. This ensures consistent query semantics. Please enable these options and then resend the query"
Solve the problem and make a record here
Problem description:
The OpenDataSource method is used in the stored procedure to call a table on another database server to obtain data. However, when executing the stored procedure, the preceding error is reported, some people say they need to add
Set ansi_nulls on
Set ansi_warnings on
However, after I added the stored procedure, the problem was not solved. After multiple tests, I found that the cross-server SQL statement operation was proposed separately and placed in
Set ansi_nulls on
Set ansi_warnings on
Exec sp_dboption -- View Database options
-- Exec sp_dboption 'db _ test', 'ansi _ nulls', 'on' -- modify Database options
-- Exec sp_dboption 'db _ test', 'ansi _ warnings', 'on' -- modify Database options
Select * From OpenDataSource (...)
Then, it's okay.
The stored procedure command is successfully executed. "~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.