title: How can I return the first 3 characters after every comma in a string in TSQL
body: <p>I have a string that I need to seperate into values seperated by commas.  I have achieved this part with the below REPLACE statement:</p>
  <p>declare @mc varchar(200)
  declare @mc1 varchar(200)
  select @mc = 'FRED&amp;#g4;&amp;#4g;MARY&amp;#g4;&amp;#4g;BILL&amp;#g4;&amp;#4g;TIMOTHY&amp;#g4;&amp;#4g;JOHNATHAN'</p>
  <p>select @mc1 = REPLACE(@mc, '&amp;#g4;&amp;#4g;',', ')</p>
  <p>The replace returns a string 'FRED, MARY, BILL, TIMOTHY, JOHNATHAN'</p>
  <p>I then want to have another variable that will return the first 3 characters of each value before the commas, so the above string would be returned as:</p>
  <p>'FRE, MAR, TIM, JOH'</p>
  <p>Anyone know how I can achieve this?</p>
  <p>Also happy for this to be done directly to the original @mc variable</p>