Jump to content

Recommended Posts

$sth =& $mdb2->func->executeStoredProc("SET ANSI_NULLS ON go exec GetItems", $bindvars); 
if (PEAR::isError($sth)) {
die("Error:" . $sth->getMessage(). ', ' . $sth->getDebugInfo());
}

 

I am getting the following error,

[Native code: 170] [Native message: Line 1: Incorrect syntax near 'go'.] 

 

Searched everywhere, cant find a way to fix it.

Try:

 

$sth =& $mdb2->func->executeStoredProc("SET ANSI_NULLS ON; GO exec GetItems", $bindvars);

 

 

Or maybe

 

$sth =& $mdb2->func->executeStoredProc("SET ANSI_NULLS ON; GO; exec GetItems", $bindvars);

 

Just tryed it, and I am getting the same issue.

 

Thank you!

Oh yeah... I just remember that for some reason, GO has to be on it's own line.

 

 

You could try:

 

 

$sth =& $mdb2->func->executeStoredProc("SET ANSI_NULLS ON\nGO\n exec GetItems", $bindvars);

 

 

But I just noticed that you're using executeStoredProc.  SET isn't a store procedure, so you should probably just run it in a normal query.  Also, some interfaces don't allow multiple queries in one go, so MDB2 might be like that.

 

 

So, you could try:

 

$mdb2->query("SET ANSI_NULLS ON;");

$mdb2->executeStoredProc("EXEC GetItems;");

Oh yeah... I just remember that for some reason, GO has to be on it's own line.

 

 

You could try:

 

 

$sth =& $mdb2->func->executeStoredProc("SET ANSI_NULLS ON\nGO\n exec GetItems", $bindvars);

Gives the same error.

But I just noticed that you're using executeStoredProc.  SET isn't a store procedure, so you should probably just run it in a normal query.  Also, some interfaces don't allow multiple queries in one go, so MDB2 might be like that.

 

 

So, you could try:

 

$mdb2->query("SET ANSI_NULLS ON;");

$mdb2->executeStoredProc("GetItems;", $items);

 

I get the error which requests ansi_null to be turned on

 

[Native 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.] 

Hrmm, is ANSI_WARNINGS set?

 

 

$mdb2->query("SET ANSI_NULLS ON;");

$mdb2->query("SET ANSI_WARNINGS ON;");

$mdb2->executeStoredProc("GetItems;", $items);

 

 

Maybe?

 

I got it to work.

Thank you!

 

$mdb2->query("SET ANSI_NULLS ON; EXEC GetItems @item='1', @page=2");

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.