Solved

SQL Server XML Export With Repeating Complex Sequences

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sql calculate reminders 11 56
How to use TOP 1 in a T-SQL sub-query? 14 33
How to read XML file attributes... 17 40
Create XML 5 33
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now