title: How to split a comma-separated value to rows
body: <p>I have <code>.csv</code> file have two columns</p>
  
  <pre><code> Main Category               Sub Category
  --------------------------------------------------------                    
  Technology/Internet    Computers/Internet,Technology/Internet,Software Downloads, Social media
  </code></pre>
  
  <p>I'd like to make these two columns like that</p>
  
  <pre><code> Main Category               Sub Category
  --------------------------------------------------------                    
  Technology/Internet    Computers/Internet
  Technology/Internet    Technology/Internet                  
  Technology/Internet    Software Downloads
  Technology/Internet    Social media
  </code></pre>
  
  <p>I tried to use this expression:
  <code>SUBSTRING(Sub Category,1,FINDSTRING(Sub Category,"-",1) + 1,LEN(Sub Category))</code>
   in <code>derived column</code> in SSIS
  but it dose not work
  and, can I put <code>while loop</code> like that in SSIS</p>
  
  <pre><code>Declare 
  @start int,
  @end int,
  @category_group Varchar(250),
  @sub_category varchar(250)
  
  set @start = 1
  set @end = 99
  set @category_group =(select distinct([Sub_Category]) from [Site_Categories])
  set @sub_category = 
  (select replace(substring([Sub_Category],1,charindex(N',',[Sub_Category],1)),',','') from  [Site_Categories])
  
  while 
  @start &lt;= @end
  begin
  insert into [dbo].[Category_group]
  ([category_group],[sub_category])
  select 
  @category_group,
  @sub_category
  
  set @start= @start+1
  end
  </code></pre>
  
  <p>please what I should do to fix this Case in SSIS</p>