String.IsNullOrEmpty like function for VARCHARs in SQL?

前端 未结 10 1891
一个人的身影
一个人的身影 2021-02-12 11:10

Say I\'ve got a function or stored procedure that takes in several VARCHAR parameters. I\'ve gotten tired of writing SQL like this to test if these parameters have a value:

10条回答
  •  一生所求
    2021-02-12 12:12

    You can just do IF @SomeVarcharParam <> '' since the condition will evaluate to NULL and the branch won't be taken if the parameter is null

提交回复
热议问题