Is there an exclusive OR operator in T-SQL?

前端 未结 3 1650
既然无缘
既然无缘 2021-02-12 15:49

This is my statement

IF (@UserName IS NULL AND @EditorKey IS NULL) OR (@UserName IS NOT NULL AND @EditorKey IS NOT NULL) BEGIN
    RAISERROR (\'One of @UserName,         


        
3条回答
  •  别那么骄傲
    2021-02-12 16:22

    As a cheat, you can do:

    If @UserName+@EditorKey is null and coalesce(@UserName,@EditorKey) is not null
    

    It's shorter, but that may be the only thing it has going for it.

提交回复
热议问题