Solved

SQL Server XML Export With Repeating Complex Sequences

Posted on 2011-09-14
1
361 Views
Last Modified: 2012-05-12
I have an export from SQL Server 2005 to XML using BCP.  I need to add some data to the export that will add repeating complex sequences to the XML output.

For example:

<Family>
<Father Name>Joe</Father Name>
<Mother Name>Jane</Mother Name>
<Child>
<Child Name>Jack</Child Name>
<Child Gender>M</Child Gender>
</Child>
<Child>
<Child Name>Jill</Child Name>
<Child Gender>F</Child Gender>
</Child>
<Child>
<Child Name>Jen</Child Name>
<Child Gender>F</Child Gender>
</Child>
</Family>

I have made an attempt at this;  I think that it created three seperate 'Family' records.

Any help in addressing this would be greatly appreciated.

Thanks In Advance
0
Comment
Question by:mjs082969
1 Comment
 

Accepted Solution

by:
mjs082969 earned 0 total points
ID: 36539015
I was able to work through this.  If anyone is wondering how to this, the key lies with the TAG, PARENT, and ELEMENT functionality in SQL Server.  These constructs will allow you to create the XML in the format that you want.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question