title: sql server how to separate full name
body: <p>im not good in asking a questions</p>
  
  <p>i want to separate fullname ( A B C B E F ) in many column i us this code to do that</p>
  
  <pre><code>    SELECT SUBSTRING(Name_Arabic, 1, CASE WHEN CHARINDEX(' ', Name_Arabic) = 0 THEN len(Name_Arabic) ELSE CHARINDEX(' ', Name_Arabic) END) name1,REPLACE(SUBSTRING(Name_Arabic, CASE WHEN CHARINDEX(' ',Name_Arabic) = 0 THEN len(Name_Arabic) ELSE CHARINDEX(' ', Name_Arabic) END + 1, LEN(Name_Arabic)), REVERSE(SUBSTRING(REVERSE(Name_Arabic), 1, CHARINDEX(' ', REVERSE(Name_Arabic)))), '') name2, 
                        REVERSE(SUBSTRING(REVERSE(Name_Arabic), 1, CHARINDEX(' ', REVERSE(Name_Arabic)))) name3
  FROM            tabl DROP TABLE tabl
  </code></pre>
  
  <p>and it gave me ( name1 = A , name2 = BCD , name3 = F )</p>
  
  <p>what i looking for is (name1 = A , name2 = B , name3 = c , name4 = D , name5 = F )</p>
  
  <p>how can i do that </p>