title: Update column using comma-separated values in SQL Server
body: <p>I have 2 tables in SQL Server:</p>
  
  <p><strong>Table1</strong></p>
  
  <pre><code>ID  SkillSetRequired                 SkillDesc
  1   100-1,101-1,102-2,103-3          null
  2   100-4,105-2                      null
  3   100-1,102-2,104-2                null  
  4   100-5,102-2                      null   
  5   105-1                            null 
  </code></pre>
  
  <p><strong>Table2</strong></p>
  
  <pre><code>ID    SkillName
  100   .Net
  101   Java
  102   JQuery
  103   Sql
  104   PHP
  105   C
  </code></pre>
  
  <p>I need to update the <code>SkillDesc</code> column of <code>Table1</code> with the SkillNames. For example in first row I need to update skilldesc as <code>'.Net,Java,Jquery,SQL'</code></p>
  
  <p>How can I do this with out using cursors?</p>
  
  <p>I am getting the result in a string from the below query for a single record. But I need to update all the rows.</p>
  
  <pre><code>declare @result varchar(max)
  
  SET @result = ''            
  SELECT @result = @result + ltrim(rtrim(SkillName)) + ',' from  #Table2 where id in(
                           select SUBSTRING(items, 0 + 1, CHARINDEX('-', items, 1) - 0 - 1)  from split('100-1,101-1,102-2,103-3',','))
                           select @result
  </code></pre>