How do I return a boolean value from a query during condition evaluation?

前端 未结 4 1479
一向
一向 2021-01-02 06:14

I need something like this:

select (len(someLongTextColumn)=0) as isEmpty;

The above doesn\'t work,

any alternatives?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 07:05

    Try this.

    SELECT (CASE WHEN LEN(SomeLongTextColumn) = 0 THEN 1 ELSE 0 END) AS IsEmtpy
    

    @gbn has good explanation about how to return boolean.

提交回复
热议问题