title: Most efficient way to output SQL table  to XML file
body: <p>I have server that needs to process and dump from an SQL database queries and tables into xml format on disk. This needs to be a scheduled task.</p>
  
  <p>Currently using BCP via a scheduled batch file > sql script > xp_cmdshell >bcp, but this error</p>
  
  <blockquote>
    <p>SQLState = S1000, NativeError = 0<br>
    Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Warning: Server data (172885 bytes) exceeds host-file field length (65535 bytes) for field (1). Use prefix length, termination string, or a larger host-file field size. Truncation cannot occur 
    for BCP output files.</p>
  </blockquote>
  
  <p>is troubling me in the log files. I have found no solution online yet. I do not quite understand what the 'host-file field' is referring to. The original table has no column with a value as large as 172885 bytes. The output files are very large, and so far it seems as thought the data is all being written, but there seems to be some garbage at the end of all the xml files.</p>
  
  <p>Performance is important but reliability is the most important for me in this situation.</p>
  
  <p>I have tried recreating the error locally but have been unsuccessful in doing so. The server runs Windows Server 2008 r2.</p>
  
  <p>Any help or explanation/analysis of the error and it's meaning, as well as a recommendation of a simple scheduled solution to dump the sql tables/queries to xml files, would be appreciated. </p>