How to use NULL or empty string in SQL

前端 未结 16 1718
悲&欢浪女
悲&欢浪女 2020-12-23 20:20

I would like to know how to use NULL and an empty string at the same time in a WHERE clause in SQL Server. I need to find records that have either null values o

16条回答
  •  孤城傲影
    2020-12-23 20:48

    youe check null With IS NULL and string Empty With LEN(RTRIM(LTRIM(Column))) = 0 in

    SELECT *
    FROM AppInfra.Person
    WHERE   LEN(RTRIM(LTRIM(NationalCode))) = 0 OR  NationalCode IS NULL
    

提交回复
热议问题