title: SQL View SUBSTRING and CHARINDEX
body: <p>I have a query in SQL 2008</p>
  
  <pre><code>SELECT [orde_reference],
         SUBSTRING([orde_reference], 
                    CHARINDEX('/', [orde_reference]) + 1, 
                    LEN([orde_reference])) AS batch
  FROM   Orders 
  </code></pre>
  
  <p>That returns the following</p>
  
  <pre><code>orde_reference:        27777/2012/1          
  batch:                 2012/1
  </code></pre>
  
  <p>However I need the batch to just be the characters after the last / (there are always 2 x '/' in the varchar</p>
  
  <pre><code>orde_reference:        27777/2012/1          
  batch:                 1
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Cheers
  Mim</p>