Problem to display output variable of stored procedure mssql using node js

Nisar2021

Newbie
Joined
Jan 3, 2021
Messages
5
Reaction score
1
I created a stored procedure of a table created in mssql database.
The Procedure has two parameters: one is output and other is input
The output parameter is primary key and generating auto.
I want to display output parameter through node js.
I tried but in vain. The code is noted below

let pool = await sql.connect(config);
const result = await pool.request()
.output(pId)
.input(pName)

.execute(spCustomerSave);
const status = {
pCityId: +result.output.pId,
pCityName: +result.input.pName,

};

res.json(status);
} catch (error) {
res.status(500).json(error);
}
Please help to correct the code.
 
Back
Top