SQL query results to CSV file?

  • Currently, I am placing the results of my SQL query into an xls file using the Excel Destination task. However, what I really need as the final output file is a CSV file. Is there a method in SSIS of either placing the query results into a csv file format, or converting the xls output to csv?

  • Use a Flat File Destination and specify the file as comma delimited.

  • Thanks for your suggestion, Mark. After playing with it for awhile, I realized that it may not work using that method. I can't just use the output from my query to create the flat file or Excel file b/c I need to have the first row have column names. To do that, I have created an Excel template (.xls) and I'm using the template as the output file to add rows to (selecting "First row has column names" in the ExcelDestination Connection).

    Perhaps there's a way to have the column names be the first row of output from my query so I can go to a flat file instead of an Excel file? I was hoping that there was a task that could convert the Excel file to a comma-delimited file. Any suggestions would be appreciated.

    Thanks

  • When you use a flat file destination, you set up your flat file connection manager. In the connection manager you can specify that the column names make up the first row (check box at the bottom of a dialog box)

  • I am not sure if I am missing something from your post... When you create a Flat File connection there is an option to create column names as the data first row.

  • Yes, you're both correct. I must have set something in the Flat File Connection manager incorrectly. Thanks

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply