Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 917501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:13:21+00:00 2026-05-15T18:13:21+00:00

(This post is soliciting personal experiences about storing XML; please share what you know.

  • 0

(This post is soliciting personal experiences about storing XML; please share what you know. 🙂 )

I am working on a service application that communicates with an external service using XML. I am planning to use SQL Server 2008 to store the XML that is received and sent to the external service. I’m exploring my options for storing the XML in the database. The three options that I have identified are:

  1. Store the XML in an XML data type column
  2. Create tables to store the various parent and child relationships represented in the XML.
  3. A hybrid of the two above approaches where the original XML is stored in an XML data type column but several fields from the XML broken out into their own columns to simplify querying and indexing.

I’m looking for any advice, based on your personal experience, with storing and retrieving XML data in SQL Server.

Some additional background: I’ve used an ‘xsd.exe’ equivalent called XsdObjectgenerator to create .net classes based on the XML schemas. When the service receives the XML file, it is deserialized into an instance of .net class. This instance is used to perform the operations of the service. My original plan was to then use option #1 above to store the XML. If I needed to update or report on the data, I would simply deserialize the db record back into one of my .net classes.

Although this approach works and makes working with the xml very simple, I have concerns that as the volume of data increases, the performance of querying XML data type records will decrease. This is why I’ve explored options 2. & 3. above.

In addition to storing the XML, the XML will be queried for use in both reports and a separate web application. The db records will be queried, sorted, filtered, grouped, summaried and possibly updated by the end users.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:13:21+00:00Added an answer on May 15, 2026 at 6:13 pm

    I guess it depends on what you want to do with your XML in your database.

    If you’re mostly only storing it, and possibly retrieving it later as a whole and sending it out again, then I’d definitely use the XML datatype – no point in shredding it into bits and pieces.

    If you however need to mostly work with the contents of the XML file, and possibly also manipulate and change that content, then it might be advisable to create tables with columns to match your XML content, and shred it when storing it, use it, and when you need to, reassemble it from the relational pieces using something like SELECT (columns) FROM dbo.Table FOR XML.....

    There is an overhead involved in shredding and reassembling – so you need to ask yourself if that’s worth doing. But there’s also an overhead involved if you need to manipulate the XML column too much.

    If you only need read-only access to a few attributes in your XML, I’ve come to appreciate the ability to wrap those into a UDF and surface it as a computed column in your table. That way, you can easily select something from your table, based on values that are stored somewhere inside your XML – quite handy! But do not overuse this approach – works fine for 2, 3 attributes – but if you need to access your XML over and over again (and most or all of it), then you might be better off shredding it into relational pieces to begin with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So this post talked about how to actually implement url rewriting in an ASP.NET
I have read this post about how to test private methods. I usually do
I just read this post about why new-line warnings exist, but to be honest
This post is a follow-up of this answered question: Best method for storing a
This post says that it is possible to turn off the CLR flag for
This post reference to the One Definition Rule. Wikipedia is pretty bad on explaining
From this post . One obvious problem is scalability/performance. What are the other problems
I this post , I've seen this: class MonitorObjectString: public MonitorObject { // some
Background this post explains how one can consume extension methods in Powershell http://community.bartdesmet.net/blogs/bart/archive/2007/09/06/extension-methods-in-windows-powershell.aspx Compare
Reading this post has left me wondering; are nightly builds ever better for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.