typeorm: Not able to Pass Parameter for Stored Procedure
Below is my Stored Procedure.
USE test
GO
CREATE PROCEDURE UPDATE_TASK @description1 nvarchar(1750)
AS
SELECT * FROM task where description1 = @description1;
GO
The above Stored Procedure, i am trying to invoke using typeorm, but it fails.
export async function storedProcedure(request: Request, response: Response) {
const manager = getManager();
const results = await manager.query(`UPDATE_TASK`, [{ description1: 'pawan' }]);
response.send(results);
}
and the Error is
QueryFailedError: Error: Procedure or function 'UPDATE_TASK' expects parameter '@description1', which was not supplied.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (7 by maintainers)
@PawanKr2feb Better to avoid TypeOrm and use some other Technology, if you are developing something for Production… @pleerock As you mentioned that TypeOrm is a ORM so it won’t work with Stored Procedure…If i go By your logic then Hibernate should also not have supported Stored Procedure…
@pleerock ORM means it should support for all databases not for only ms SQL. Node ms SQL supports for only ms SQL server.
Jana2018 is a new user registered an hour ago, does the same styles messages and mistakes as OP. Really, better if you spent that time to read node-mssql documentation.
For MSSQL Please use try below code, await manager.query(‘EXEC UPDATE_TASK’+ ‘pawan’);
If multiple params, use comma separator for every params.
ORM does not mean it. ORM is all about object relational mapping.