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

XML from SQL

Status
Not open for further replies.

tbg130

Programmer
Aug 11, 2004
46
CA
Hi,

I have to export a variety of data from SQL for use within another program. I want to export my data to XML format so that it can simply be picked up and used by the other program.

I have figured out how to export some basic queries (more complex ones to come) but need to know how to format the data properly.

I can get it to export the following:

<Institutions Name="NAMEFROMSQL" Category="CATFROMSQL">
<Member>SQLDATA</Member>
</Institutions>

I need to include some custom text in the export that would make all records look like the following:

<Institutions Name="NAMEFROMSQL" Category="CATFROMSQL">
<Member type="host" method="match_pattern">SQLDATA</Member>
</Institutions>

Eventually, I'll need to do some sort of group by and export the following:

<Institutions Name="NAMEFROMSQL" Category="CATFROMSQL">
<Member type="host" method="match_pattern">SQLDATA</Member>
<Member type="host" method="match_pattern">SQLDATA</Member>
<Member type="host" method="match_pattern">SQLDATA</Member>
<Member type="host" method="match_pattern">SQLDATA</Member>
<Member type="host" method="match_pattern">SQLDATA</Member>
<Member type="host" method="match_pattern">SQLDATA</Member>
</Institutions>

Is this possible and can anyone tell me how to do this?

Thanks in advance.
 
Another problem I'm having is with the layout of the XML data; it seems to be in one long line and not in new lines for every row of data...

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top