title: How to convert rows values into column in sql server 2005
body: <p>How to convert row into column.I have following result set.</p>
  
  <pre><code>UserID  VendorName  QuestionText AnswerText
  1         KK         abc1         ans1
  1         KK         abc2         ans2
  1         KK         abc3         ans3
  2         JJ         abc1         ans2
  2         JJ         abc2         ans3
  2         JJ         abc3         ans1   
  </code></pre>
  
  <p>OUTPUT should be:</p>
  
  <pre><code>UserID VendorName   abc1    abc2   abc3
  1             KK    ans1    ans2   ans3
  2             JJ    ans2    ans3   ans1
  </code></pre>
  
  <p>Thanks.</p>