Solved

SQL Server XML Export With Repeating Complex Sequences

Posted on 2011-09-14
1
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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