tedious
tedious copied to clipboard
Support for Table-Valued Parameters in execSql
Calling execSql with a TVP results in the error
Could not find stored procedure 'sp_executesql'
Example code:
var table = {
schema: 'dbo',
name: 'MyTVP',
columns: [
{ name: 'Name', type: TYPES.VarChar, length: 50 },
{ name: 'Rating', type: TYPES.Int },
],
rows: [['Foo', 1]]
};
var request = new Request('select * from @TVP', (err) => {
if (err) {
console.log(err);
}
connection.close();
}
);
request.addParameter('TVP', TYPES.TVP, table);
connection.execSql(request);
Thanks for raising this issue, I'll take a closer look at it soon!
How is this going? Every time I want to use TVP I have to implement procedures where I really want to use ordinary SQL statements (TSQL).
For my part it fails with The procedure "sp_executesql" has no parameter named "@<tvp input name>".
when using tedious through mssql@^9
Hi @lostfields , this PR #1327 seems has the changes for this issue. Can you give it a try, see if it fixes your issue? If yes, we can work with @arthurschreiber , see if we can merge and release this fix.
Wow, amazing @MichaelSun90 ! That branch worked out of the box through library mssql
. I have only tested TVP, nothing more though.
@lostfields , glad to know that works. We will try to get the fix out as soon as possible.
Fixed via https://github.com/tediousjs/tedious/pull/1327.