SQL Script to Export Query Results to Excel
530085Aug 25 2006 — edited Aug 25 2006I want to export query results from a database query to Excel. I have seen several threads saying do this:
SQL>spool c:\results.csv
SQL>query
SQL>spool off
That would be a good solution, but I am trying to automate a script so a non-technical user can do it. I want them to just enter one command, and they get the results from the query in Excel. They will not be entering commands at the command line one at a time (like above), they will just run 1 script.
When I try to add the code above to a script, it writes to the current directory with a file named c:\results.csv . Obviously that's not where I want it to go or how I want it named. I want it in the c: directory with the name results.csv .
Any ideas? Thanks!