Toad World® Forums

Exporting to .csv file type with character quotes

Hi, our company does LOTS of ad hoc reports and therefore don’t need to always use the automation feature. We have a need for some reports to go to a .csv (Comma Separated Values) format, but most like this exported report to have quotes around the characters. This is especially useful in text fields that have all numerics or start with zeros, to ensure they don’t come over as number. I notice the only option when exporting the results of a query to .csv is to export data to a .csv file using the one click export option. It doesn’t allow you to specify any other options on how the export should go, for example saying characters should have quotes or to include header rows, similar to how Microsoft Access would do. I wonder if there is an option outside of moving the query to automation to get quotes around character fields on .csv exports? If not, could this be some type of enhancement? I have the once click export set to prompt me for location every time. Maybe if that item is clicked, there could be additional options around that to include the quotes for characters and even if the header row should exist or not?

Just wanted to get some ideas. Thanks!

Chad King

Those options exist in the export wizard. No need to use automation.

Debbie, I’m with you and thanks for the heads up! I didn’t know you could use the export wizard outside of automation. The only tricky thing though is the fact that the query has to either be linked or written in the export wizard (which is very hard by the way, hitting enter to start a new line in the SQL causes it to move forward in the export wizard) and then reran from there. We normally find ourselves in situations writing queries where we need to modify it as we put it together and using the editor or query builder seems to work best for these ad hoc queries such as this. Therefore, if we run a query and make sure the results look good, we still have to save the SQL or paste it into the export wizard and then run it again to get it to output the way we want. I guess the idea I had was setting up options for the one click export to be able to use or not use quotes when going to .csv and not having to go through all the steps of setting up an export wizard and rerun. Plus if there are changes that have to be made to the .sql you really can’t test with the export wizard, you always have to test in editor first to make sure you have no SQL errors. I appreciate it though, this will work and be helpful at this point, but maybe again it could be a suggestion for a future enhancement for the one click export to .csv. Thanks again! Chad

One click export, is well, supposed to be one-click. I do see what you are saying. I will keep it in mind.

If you right click the results of a query you should be able to get to the wizzard options. After right click select Export/ExportWizzard. It is not one click but it will get you there.

Greg, you are awesome! I was also unaware you can do that and this really allows you to use the simplest form of the export wizard without having to re-query the results. I think this will work absolutely perfect! Debbie and Greg, thank you so much for your time and this helpful information!