title: sql server extract the "like substring"
body: <p>I would like to get the "like substring" of select statement.</p>
  
  <p>MyTable:</p>
  
  <pre><code>Container      ItemName
  
  101            QQQ A12 DDD
  101            QQTT A12 R33 
  102            QQQ A3 AB3
  103            QQ BB BB11
  </code></pre>
  
  <p>The select statement work fine to get the rows (records) I need (without the "like substring") </p>
  
  <pre><code>SELECT Container, &lt;like substring&gt;
    FROM MyTable
    Where (ItemName like '%A[0-9] %') OR (ItemName like '%A[0-9][0-9] %')
    GROUP BY Container, &lt;like substring&gt;
  </code></pre>
  
  <p>As a result I hope to get:</p>
  
  <pre><code>Container      "like substring"
  
  101            A12
  102            A3
  </code></pre>
  
  <p>The real question is how to get(display) the substring found by the like logical operator </p>
  
  <p>How should I do it?</p>
  
  <p>Thanks
  Yossi</p>