tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.23k stars 465 forks source link

Executing stored procedure on linked server breaks in tedious.js before returning results. #1487

Closed lpoulin closed 1 year ago

lpoulin commented 1 year ago

When executing a stored procedure on a linked server using execute(), for some reason the returnValue event in tedious.js is being triggered with parameterName: '' and value:0. image This causes the highlighted line to break and crash our app.

Expected behaviour:

This event should not be called at all since this proc does not contain an output param, and one is not supplied. I expect the record sets to be returned.

Actual behaviour:

Line 1210 of tedious.js breaks since there is no parameter with the name of ''. The recordesets in the class contain the data we expect back but never get returned since it breaks beforehand. Note: we have an identical proc on our regular sql server that behaves perfectly, but as soon as we try to call the linked server version execute('linkedServer.database.dbo.procname'), this error occurs.

Software versions

dhensby commented 1 year ago

I think it makes sense that this is raised with the tedious library first. If this usually works but not with linked servers then if feels like a lower-level error.