title: Is there an exclusive OR operator in T-SQL?
body: <p>This is my statement</p>
  
  <pre><code>IF (@UserName IS NULL AND @EditorKey IS NULL) OR (@UserName IS NOT NULL AND @EditorKey IS NOT NULL) BEGIN
      RAISERROR ('One of @UserName, @EditorKey must be non-null.', 15, 0)
      RETURN
  END
  </code></pre>
  
  <p>What I want is to be able to do something like this:</p>
  
  <pre><code>IF (@UserName IS NOT NULL) XOR (@EditorKey IS NOT NULL) BEGIN
      RAISERROR ('One of @UserName, @EditorKey must be non-null.', 15, 0)
      RETURN
  END
  </code></pre>
  
  <p>For two parameters it isn't that big of a deal, but some procs have three or four where in only one may be passed and the rest should be null.</p>