title: CHARINDEX issue with NULL CHAR variable
body: <pre><code>DECLARE @MyChar CHAR = NULL
  
  SELECT  CHARINDEX(' ', ISNULL(NULL, '')),
          CHARINDEX(' ', ISNULL(@MyChar, '')),
          CHARINDEX(' ', ISNULL(CONVERT(VARCHAR, @MyChar), ''))
  </code></pre>
  
  <p>The above query returns the values <code>0</code>, <code>1</code> and <code>0</code>, in that order.<br>
  This result should be <code>0</code>, <code>0</code> and <code>0</code>. Is this an issue with MS SQL or there is some functionality here which I haven't understood?</p>