darksniperx Posted January 28, 2009 Share Posted January 28, 2009 $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 Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/ Share on other sites More sharing options...
corbin Posted January 28, 2009 Share Posted January 28, 2009 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); Quote Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748662 Share on other sites More sharing options...
darksniperx Posted January 28, 2009 Author Share Posted January 28, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748720 Share on other sites More sharing options...
corbin Posted January 28, 2009 Share Posted January 28, 2009 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 Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748750 Share on other sites More sharing options...
darksniperx Posted January 28, 2009 Author Share Posted January 28, 2009 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.] Quote Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748817 Share on other sites More sharing options...
corbin Posted January 28, 2009 Share Posted January 28, 2009 Hrmm, is ANSI_WARNINGS set? $mdb2->query("SET ANSI_NULLS ON;"); $mdb2->query("SET ANSI_WARNINGS ON;"); $mdb2->executeStoredProc("GetItems;", $items); Maybe? Quote Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748840 Share on other sites More sharing options...
darksniperx Posted January 28, 2009 Author Share Posted January 28, 2009 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"); Quote Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748873 Share on other sites More sharing options...
corbin Posted January 28, 2009 Share Posted January 28, 2009 Ah, so it worked without the GO. Glad you figured it out ;p. Quote Link to comment https://forums.phpfreaks.com/topic/142808-solved-incorrect-syntax-near-go-how-do-i-fix-it/#findComment-748878 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.