sql.Bit always true
trying to update a BIT value,
request.input('active', sql.Bit, req.body.Active); .... .... SET += ', Active = @active';
getting no errors but active is always true
Might be helpful to provide more information about your use case. Example: What does your query statement look like? Is it a stored proc? If so, is @active a parameter exposed on it, or, is @active declared internally within the proc? What does your request.body look like?
running as a parametrized query. client side problem passing a true false value. got it working
Ran into the same problem, had to do following to make it work
if (Enabled == 1 || Enabled.toUpperCase() == "TRUE" || Enabled.toUpperCase() == "YES" || Enabled.toUpperCase() == "Y")
{
Enabled = true;
}
else
{
Enabled = false;
}
for a column defined as Bit mssql_request.input('Enabled', mssql.Bit, Enabled);
so this actually enables consumer to pass any of the values mentioned in if clause offering additional flexibility while solving the issue with Bit type