title: Using PatIndex and CharIndex like the InStr function
body: <p>I tried using <code>Instr</code> for this, but didn't work, so I found the supposed to be equivalent using <code>PatIndex</code> and <code>CharIndex</code>, however, I'm having an issue here when I run this:</p>
  
  <pre><code>SELECT PATINDEX(`http://www.stackoverflow.com`,'%.com%')
  </code></pre>
  
  <p>This returns <code>0</code></p>
  
  <hr>
  
  <pre><code>SELECT CHARINDEX(`http://www.stackoverflow.com`,'%.com%')
  </code></pre>
  
  <p>This returns <code>0</code></p>
  
  <hr>
  
  <pre><code>SELECT PATINDEX(`http://www.stackoverflow.com`,'.com')
  </code></pre>
  
  <p>This returns <code>0</code></p>
  
  <hr>
  
  <pre><code>SELECT CHARINDEX(`http://www.stackoverflow.com`,'.com')
  </code></pre>
  
  <p>This returns <code>0</code></p>
  
  <hr>
  
  <p>How do I get this to work like <code>InStr</code> ?</p>
  
  <p>If my calculation is correct, it should return <code>25</code> instead of <code>0</code>, anyone know why it's not?</p>