Solved

Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS

Posted on 2012-03-28
1
2,486 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

778 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