-
Notifications
You must be signed in to change notification settings - Fork 475
Closed
Description
Providing Table Value Parameter as input to query fails on sp_executesql
Expected behaviour:
The query to execute successfully and give the result of
Actual behaviour:
The query fails to execute due to an issue with sp_executesql
Example that works in raw tsql
CREATE TYPE MyAwesomeType AS TABLE (storeNbr INT);
DECLARE @tvp StoreNumberTableType
INSERT INTO @tvp
VALUES (1), (2)
exec sp_executesql N'SELECT * FROM @tvp', N'@tvp MyAwesomeType readonly', @tvp
Translated example that fails in node-mssql
const t = new sql.Table('MyAwesomeType');
t.columns.add('storeNbr', sql.Int);
t.rows.add(1);
t.rows.add(2);
const req = connection.request();
req.input('tvp', t);
return req.query(`SELECT * from @tvp`);
Configuration:
// paste relevant config here
Software versions
- NodeJS: 12.13.1
- node-mssql: 6.2.1
- SQL Server: Enterprise 2017
Metadata
Metadata
Assignees
Labels
No labels