Sidebar

Stored procedure is returning null in QIE but SSMS returns a value

0 votes
549 views
asked Apr 8, 2015 by oscar-p-6691 (550 points)

I am trying to run a stored procedure and I get this error:

TypeError: Cannot call method "getNode" of null in <Unknown Source>

Here is my code:

var qResult = qie.doQuery(

   "Database",

   "EXEC storedProcedure '"+acc+"', '"+insID1+"'");

var results = qResult.getNode('Result');

2 Answers

0 votes
 
Best answer
As explained by the awesome people in support, all I needed to do was add "SET NOCOUNT ON\n " before EXEC storedProcedure.  This returned the real result instead of a null result that an update in the stored procedure was providing.  They gave more details but this is the basics of it.
answered Apr 8, 2015 by oscar-p-6691 (550 points)
selected Apr 13, 2015 by oscar-p-6691
commented Apr 8, 2015 by david-f-5427 (1,600 points)
This topic, including this same answer, is discussed in greater depth at this KB question/answer: https://www.qvera.com/kb/index.php/709/is-it-possible-to-get-return-code-from-sql-stored-procedure?show=709#q709
0 votes

As of version .51, QIE adds support for calling stored procedures that do not contain SET NOCOUNT ON.

Examples can be found in this question:

How to call a stored procedures in QIE?

For reference the previous answers in this question use required either the stored procedure in the database server be updated to use the SET NOCOUNT ON or to send SET NOCOUNT ON to the server before the EXEC statement. 

answered Jul 20, 2021 by rich-c-2789 (16,180 points)
...