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.
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.