Wednesday, 17 August 2016

Export sql server query output to CSV - via BCP utility

To export SQL query data to a comma separated value (CSV) file we can use Bulk Copy Program (bcp) utility. Follow below steps to get the desired CSV file.


  1. Enable xp_cmdshell property to use the bcp utility 
  2. Write the desired query and passed it in the xp_cmdshell command 
    3. Output CSV

No comments:

Post a Comment