Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export a mySQL table to CSV on Client Computer

Status
Not open for further replies.

SmokeyJoe

Programmer
Nov 13, 2000
80
US
I need to export on-demand a MySQL table on a server to a CSV file on the client computer. The MySQL reference manual 13.2.7 states;

"If you want to create the resulting file on some client host other than the server host you cannot use SELECT .... INTO OUTFILE. In that case, you should use instead a command such as mysql-e "SELECT ..."> file name to generate the file on the client host."

Have been unable to find anything on mysql-e, thanks for any info on how to use this.

SmokeyJoe
 
What if you use ADO to connect to the database in an ASP script. You could use an ADO connection object to Execute a SQL SELECT statement to get the data into an ADO recordset object. Then you could use the recordset's GetRows method to copy the data out of the object into an array. Then, assuming you are using VBScript for your ASP, you could use the Join function to convert the array into a text string. Then you could write the string out to the browser using the Response object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top