title: Convert all rows of a column into comma separated values
body: <p>I have a table with this structure in Sql server 2005.</p>
  
  <pre><code>TABLE TPilot
  (
      Num_Office char(3) NULL,
      AppID char(3) NULL
  )
  </code></pre>
  
  <p>and having around 998 records in the table with "Num_Office" value starting from 2 to 999.
  I want to get all office values in a single row with comma separated values like 2,3,4,5..999</p>
  
  <p>The below is the query which i using right now-</p>
  
  <pre><code>select stuff((select ','+ Num_Office from TPilot for xml path('')),1,1,'')
  </code></pre>
  
  <p>The issue here is-it does not return all the row values. it just return around 65 rows.</p>
  
  <pre><code>2  ,3  ,4  ,5  ,6  ,7  ,8  ,9  ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ,36 ,37 ,38 ,39 ,40 ,41 ,42 ,43 ,44 ,45 ,46 ,47 ,48 ,49 ,50 ,51 ,52 ,53 ,54 ,55 ,56 ,57 ,58 ,59 ,60 ,61 ,62 ,63 ,64 ,65 ,
  </code></pre>
  
  <p>Please suggest what i am missing here.</p>