title: Export xml data using BCP Command in SQL Server
body: <p>I am trying to export datable data in xml format but,Problem is like i can able to create xml file but data is not get writing in to the file following is my code I am trying.</p>
  
  <pre><code>DECLARE @cmd  VARCHAR(2000);
  
  SET @cmd = 'bcp.exe "select * from emp FOR XML AUTO" queryout E:\rahul_1.xml -x -T';
  
  EXEC xp_cmdshell  @cmd ;
  </code></pre>
  
  <p>And following is the output message I am getting after executing above code</p>
  
  <pre><code>NULL
  Enter the file storage type of field XML_F52E2B61-18A1-11d1-B105-00805F49916B [ntext]: 
  </code></pre>
  
  <p>can any body please suggest me on this </p>