0

I'm trying to execute a stored procedure in Javascript of this way:

xmlhttpPost2(2,"BuscaProducto","EXEC GetProductStk");

But the browser says: 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.

I know that is not correct execute queries in the client-side, but i need to make in this way.

In the same web application I execute another Stored Procedure:

xmlhttpPost2(2, "BuscaCliente", "EXEC getCliente "+idCliente); 

And this if it works.

The difference are that the first Stored Procedure called to a table that is in a Linked Server.

Analizing the error I have a Test with php:

$ansiwarnings = "SET ANSI_WARNINGS ON";;
$ansinulls = "SET ANSI_NULLS ON";
$ansiwarnings = mssql_query($ansiwarnings);
$ansinulls = mssql_query($ansinulls);
$query = "EXEC GetProductStk '$sku', '$sucursal', '$cliente'";
$query = mssql_query($query);

And the SP runs correctly.

My question is:

What way I run ANSI_NULLS and ANSI_WARNINGS in the xmlHttpRequest by Javascript?

Thanks in advance.

Miguel Marroquin
  • 129
  • 1
  • 3
  • 10

0 Answers0