title: Copy table data into text file
body: <p>I'm trying to insert data into text file from select query using SQL Server 2012. But I'm not able to to this please help me.</p>
  
  <p>Code</p>
  
  <pre><code>EXEC xp_cmdshell 'bcp "Select RecodLine from WorkDataLoad" queryout "D:\Test.txt" -T -SSubhash-Pc -c -t,'
  </code></pre>
  
  <p>Error </p>
  
  <blockquote>
    <p>Starting copy...<br>
    SQLState = S0002, NativeError = 208<br>
    Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name 'WorkDataLoad'.<br>
    SQLState = S1000, NativeError = 0<br>
    Error = [Microsoft][SQL Server Native Client 11.0]Unable to resolve column level collations</p>
    
    <p>BCP copy out failed</p>
  </blockquote>