Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 merge query results

Author  Topic 

isaacbs
Starting Member

10 Posts

Posted - 2003-07-02 : 13:34:50
I generate half of an XML document with one stored procedure and the other half with another stored procedure

How can I merge the result of both stored procedures in one XML document, something like this

<root>
<firstSPResult>
<moreNodes/>
</firstSPResult>

<secondSPResult>
<otherNodes/>
</secondSPResult>
</root>

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-02 : 13:36:32
Why are you doing this in two stored procedures? Why don't you just do it in one stored procedure and use UNION if the results are from different tables?

Tara
Go to Top of Page

isaacbs
Starting Member

10 Posts

Posted - 2003-07-02 : 13:53:35
Well I thought about the UNION operator but the first SP generates only one node that is unique in the document and comes from tables with different data types and number of columns than the ones that queries the second SP, which generates many nodes, completely different from the one that generates the first SP

but I'm not sure if there is a way to combine both results in SQL2K

Thnx in advance
Isaac

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-07-02 : 13:58:36
If the nodes are so different, then why would you want to combine them?

Tara
Go to Top of Page

isaacbs
Starting Member

10 Posts

Posted - 2003-07-02 : 14:13:44
The XML document represents a purchase order

The first SP generates information that is only placed once in the purchase order, something like a header that contains the provider information for example

The second stored procedure generates the nodes that contain information about the items for that order

at the end the combination of both will make the complete purchase order

Go to Top of Page
   

- Advertisement -