Shows the problem nicely. BOL says its an integer. SQL does not treat a bit like an integer. You have to cast it (as you did) or get
Msg 8117, Level 16, State 1, Line 1 Operand data type bit is invalid for max operator.
Shows the problem nicely. BOL says its an integer. SQL does not treat a bit like an integer. You have to cast it (as you did) or get
Msg 8117, Level 16, State 1, Line 1 Operand data type bit is invalid for max operator.