Using execSqlBatch worked! I had tried adding the SET statements to
the stored procedure and using execSql to issue the SET statements, to
no avail. However, now I've got a different issue...
The stored procedure either updates a row or inserts a new one in the
database. Both actually work, so I assume the issue is with whatever
data is getting returned to tedious after the stored procedure
completes. If it's updating, everything works fine. If it's inserting
a new row, I get the following...
The main difference between the two cases, other than INSERT vs
UPDATE, is that another stored procedure is executed in the insert
case (in order to get an ID).
----------------
/home/jcornwell-shiel/node/node_modules/tedious/lib/token/token-stream-
parser.js:103
throw error;
^
Error: Unsupported ENVCHANGE type 8 BEGIN_TXN at offset 3
at Object.227 (/home/jcornwell-shiel/node/node_modules/tedious/lib/
token/env-change-token-parser.js:67:15)
at Parser.nextToken (/home/jcornwell-shiel/node/node_modules/
tedious/lib/token/token-stream-parser.js:81:35)
at Parser.addBuffer (/home/jcornwell-shiel/node/node_modules/
tedious/lib/token/token-stream-parser.js:65:17)
at Connection.sendPacketToTokenStreamParser (/home/jcornwell-shiel/
node/node_modules/tedious/lib/connection.js:439:35)
at Connection.<anonymous> (/home/jcornwell-shiel/node/node_modules/
tedious/lib/connection.js:146:23)
at Connection.dispatchEvent (/home/jcornwell-shiel/node/
node_modules/tedious/lib/connection.js:375:59)
at MessageIO.<anonymous> (/home/jcornwell-shiel/node/node_modules/
tedious/lib/connection.js:329:20)
at MessageIO.emit (events.js:67:17)
at MessageIO.<anonymous> (/home/jcornwell-shiel/node/node_modules/
tedious/lib/message-io.js:47:12)
at Socket.<anonymous> (/home/jcornwell-shiel/node/node_modules/
tedious/lib/message-io.js:3:59)
----------------
If I change token-stream-parser.js:97 and env-change-token-parser.js:
67 from throw new Error(...) to console.log(...), execution continues
unhindered.
On Jun 6, 3:41 am, Mike Pilsbury <
mike.pilsb...@gmail.com> wrote:
> The only SET statement that tedious executes on a newly established
> connection is SET TEXTSIZE. It doesn't execute a SET statement for any
> of CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS or ANSI_PADDING. I can only
> assume that other clients, such as SQL Management Studio, do set values for
> some of these.
>
> You could try executing SET statements to turn some of them ON or OFF
> before executing the problematic stored procedure. The "Considerations ..."
> section inhttp://
msdn.microsoft.com/en-us/library/ms190356.aspxwarns "if
> a SET statement is specified in a dynamic SQL string that is run by using
> either sp_executesql or EXECUTE, the value of the SET option is restored
> after control is returned from the batch specified in the dynamic SQL
> string.". As Connection.execSql uses sp_executesql, you should use
> Connection.execSqlBatch to execute the SET statements.
>
> Alternatively you could try adding the necessary SET statements to the
> start of your stored procedure. Inhttp://
msdn.microsoft.com/en-us/library/ms190356.aspxit states "If a SET