Solved

SQL Server XML Export With Repeating Complex Sequences

Posted on 2011-09-14
1
364 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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