What is the best way to convert an int or null to boolean value in an SQL query?

前端 未结 10 1251
情话喂你
情话喂你 2021-02-06 21:07

What is the best way to convert an int or null to boolean value in an SQL query, such that:

  • Any non-null value is TRUE in the results
  • Any
10条回答
  •  名媛妹妹
    2021-02-06 21:57

    You may want to do a Convert(BIT, Value) of your result. Because something SQL will return an error that the value is not a boolean.

提交回复
热议问题