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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create an XML file from a select statement?

Status
Not open for further replies.

lhugh

MIS
May 21, 2000
115
CA
Is it possible to do that?

For example can I create an XML file from the below select statement?

SELECT firstname, lastname FROM employee

 
There's no facility in the MySQL server to let you do that, but it can certainly be done using program code. Or, you could do a quick web-search and have a look at some of the several utilities listed, for example [link]http://ems-hitech.com/mysqlutils[/url].

-----
ALTER world DROP injustice, ADD peace;
 
Howsabout -

%mysql -X -e "SELECT * FROM table" dbname -ubloggs -p

sample output -

<row>
<id>221</id>
<agent_id>MMCMILLA</agent_id>
<forename>Mary Jane</forename>
<surname>McMillan</surname>
</row>
/resultset>


Hope this helps ....

Rab

 
Ah! Didn't know about that! That could be useful.

-----
ALTER world DROP injustice, ADD peace;
 
TonyGroves said:
Ah! Didn't know about that! That could be useful.

My thoughts entirely.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
A star for rab54!


If you perform "mysql --help", you will get that datum.

<darkly muttering>
But it would be nice if MySQL AB would update their man pages.
</darkly>



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipnir214 -

cheers - my first star ! - woo hoo ;-)

Rab
 
<facetious>
In the U.S. Army, it is the tradition that when a commissioned officer is saluted the first time, the new officer must give the person rendering the salute a dollar coin.

It is also the tradition in the U.S. Army that when a warrant officer is saluted for the first time that he give the person rendering the salute a paper dollar.

I'd guess you owe me a penny.
</facetious>



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I found another way

mysqldump --xml databasename tablename >output_filename.xml
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top