Jump to content

[SOLVED] Incorrect syntax near 'go' , How do I fix it.?


darksniperx

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.

  Quote

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;");

  Quote

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.

  Quote

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

  Quote

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");

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.