I suspect that the 'Flag1' field has other values ββin addition to 'true' and 'false'. So check the values ββin Flag1.
select the excellent Flag1 flag from YouTable.
Here is my proof:
declare @Flag varchar(25) = 'False' select CONVERT(Bit, @Flag)
It works great.
However, this will give the same error.
declare @Flag varchar(25) = ' False' -- Pay attention to the the space in ' False'! select CONVERT(Bit, @Flag)
-> Msg 245, level 16, state 1, line 2 Conversion error when converting varchar 'False' value to data type bit.
Pay attention to the place in the "False" field in the error message!
source share