title: Cut a part of value in SQL Server using substring?
body: <p>I have this data in my column:</p>
  
  <pre><code>32-HC-100-10001-G03P2-N-1-1001
  </code></pre>
  
  <p>The problem is my value doesn't have a fixed length. What I need to do is split this value into 2 columns <code>32-HC-100-10001-G03P2-N</code> and <code>1</code> - the numbers after last <code>-</code> don't important </p>
  
  <p>Another example </p>
  
  <pre><code>4-G-100-10029-F23S-S-2-1001
  </code></pre>
  
  <p>should be split into <code>4-G-100-10029-F23S-S</code> and <code>2</code>. I have used <code>SUBSTRING([Line No#], 0, 21)</code> but because of the length it didn't work.</p>