title: combine 2 coulmns as one column in sql server and showing in combobox
body: <p>i want to combine 2 columns as one and align 2nd col combined.</p>
  
  <p>Example (i want to combine company id and name as 1 column),</p>
  
  <pre><code>coid               coname
  
  co1                company 1
  
  comp2              company 2
  
  companyid3         company 3
  </code></pre>
  
  <hr>
  
  <p>if i simply do select coid + '   ' + coname from mytable, then it gives me result as,</p>
  
  <pre><code>co1   company 1
  
  comp2   company 2
  
  companyid3   company 3
  </code></pre>
  
  <p>i want to align 2nd col (i.e. coname to like ),</p>
  
  <pre><code>co1                company 1
  
  comp2              company 2
  
  companyid3         company 3
  </code></pre>
  
  <hr>
  
  <p>My code, (i am trying following code) - But still not aligned </p>
  
  <p>i am trying to get max length of coid then add accordingly. In above e.g. add only 5 spaces to 3rd record, add 10 spaces in 2nd record and add 12 spaces in 1st. But still no use may be bucause width of individual character. Anyone have have any idea to do this.</p>
  
  <pre><code>Dim mySql As String = "declare @len1 int " &amp; Chr(10)
  mySql = mySql &amp; "select @len1 =  max(len(coid)) from mytable" &amp; Chr(10)
  mySql = mySql &amp; "select coid, coid + space(@len1-len(coyid)+5) + coname as coname from mytable order by coid" &amp; Chr(10)
  Dim sqladp As New SqlClient.SqlDataAdapter(mySql, _SqlCon.sqlCon)
  </code></pre>
  
  <p>i want to show this in combobox. User should select company from list.</p>