T-SQL CASE Clause: How to specify WHEN NULL

后端 未结 15 1977
心在旅途
心在旅途 2020-11-28 05:42

I wrote a T-SQL Statement similar like this (the original one looks different but I want to give an easy example here):

SELECT first_name + 
    CASE last_na         


        
15条回答
  •  长情又很酷
    2020-11-28 05:59

    I tried casting to a string and testing for a zero-length string and it worked.

    CASE 
       WHEN LEN(CAST(field_value AS VARCHAR(MAX))) = 0 THEN 
           DO THIS
    END AS field 
    

提交回复
热议问题