Solved

Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS

Posted on 2012-03-28
1
2,406 Views
Last Modified: 2012-08-13
Can anyone help me in fixing this error. The MsSQL query works fine in a SQL query windows, but not in a PHP page. I have put SET ANSI_NULLS ON; SET ANSI_WARNINGS ON; SET NOCOUNT ON;  before the query but still no luck. Below is the error i get.

Warning: mssql_query() [function.mssql-query]: message: 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. (severity 16) in C:\inetpub\wwwroot\labs\test.php on line 18

Warning: mssql_query() [function.mssql-query]: Query failed in C:\inetpub\wwwroot\labs\test.php on line 18
A error occured: 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
Comment
Question by:previewservices
1 Comment
 

Accepted Solution

by:
previewservices earned 0 total points
ID: 37776777
Worked it out. Added this BEFORE my statement rather than at the start of the main query.

$result = mssql_query("SET ANSI_NULLS ON;");
$result = mssql_query("SET ANSI_WARNINGS ON;");
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now