Any ideas on how to quickly and easily export a SQL result set to CSV? There are options to dump to the log and to XML, how about a plain old CSV/Tab delimited text file? I was hoping for something a little more effcient/elegant than iterating through a record set and writing to a file line by line...
I even tried writing the SQL output to the log and then exporting the log fragment, but the output includes a header in the file and there isn't any "bare" option or an option to exclude the header from the output...
Which database engine are you talking to. If it’s ms sql server then you can use the MSSQL Execute SQL action, and set it to use osql and the separator to a comma, and set the output to go to a file.
I just came across this post, as I am looking to do the same thing…but there is no choice for separator that is a comma. I see Tab, space, and Pipe only.
That looks correct. I would suggest using pipes, then replacing them with commas. You can achieve this by reading in the file, then iterating through the lines replacing pipes with commas before writing out to an output file.