title: How to split a joined column into its seperate columns and use the data? (VB.Net + SQL Management Studio)
body: <p>This is gonna be somewhat tricky to explain but I'll try to break it down. Note that this is created using VB.Net 2003.</p>
  
  <p>I have a Web page which requires user to input data to save into SQL. They are required to fill in:</p>
  
  <pre><code>Course: {Select via drop-down table}  \\ Variable name = Crse
  
  Emp No: {Manually type the number}    \\ Variable name = Emp
  </code></pre>
  
  <p>For the drop down list for Course, the data is obtained from an SQL table 'Course', with the columns:</p>
  
  <pre><code>| Course Code | Course Title |
  </code></pre>
  
  <p>Once input complete, I can then save the entry into my Emp_Course table in SQL using the query:</p>
  
  <pre><code>Dim updateState As String = "insert into EMP_COURSE" _
                            &amp; "(Employee_No, CourseCode)" _
                            &amp; "values('" &amp; Emp.Text &amp; "', " _
                            &amp; "'"Crse.SelectedItem.ToString &amp; "')"
  </code></pre>
  
  <p>Previously the drop-down list only needed the show Course Code, but now I'm required to add in the Course Title as well. Another thing to point out is that the Course Code has no fixed length.</p>
  
  <pre><code>Drop-down list sample:
  
    Before:
            A001
            BX003
  
    After:
            A001 - Course A
            BX003 - Course BX
  </code></pre>
  
  <p>Meaning I have to change the logic in populating the drop-down list:</p>
  
  <pre><code>Dim list As New SqlCommand("select CourseCode + ' - ' " _
                           &amp; "+ CourseTitle as Course from [SQL].[dbo].[Course] " _
                           &amp; "order by CourseCode", SQLDB)
  </code></pre>
  
  <p>Now comes my main issue, when I want to save my entry, the program obviously gives an error because the SQL still refers to the Course Code only, while my drop-down list is a Code + Description hybrid.</p>
  
  <p>So since now I've made my course selection, how am I supposed to add to my SQL to update Emp_Course table to tell it to select the Course Code part of my hybrid selection?</p>
  
  <p>I would just go to the Course table and just add a new Code + Title column and refer to that, but I have no authority to modify it and need to work around it.</p>
  
  <p>Any other alternatives I can use?</p>