I am trying to do simple UPDATE query and store a percentage value which will go in a percentage column that is of type float in my sql server database.
When I do this:
var percentage = 3.1415;
const updateAttendence = await sql.query `UPDATE Attendence SET percentage = ${ percentage } WHERE session_id = ${ parseInt( req.body.session ) } AND student_id = ${ parseInt( req.body.AttendanceData[i].id ) } `;
I get this in my database
and when I do this - replace percentage = ${ percentage }
with percentage = 3.1415
const updateAttendence = await sql.query `UPDATE Attendence SET percentage = 3.1415 WHERE session_id = 1 AND student_id = 1 `
I get what i wanted with percentage = ${ percentage }
I don't get it why its not working as it suppose to. Is it just me or anyone else having this issue and what are the solutions to such a simple thing becoming a problem ( well at least for me ).
-Thanks
via Ahmed.J
No comments:
Post a Comment