0

Sorry this might be a very simple question,
I can't find anywhere give me a sure answer,
and I'm very new to the database management system,
so please give me a short guide.

Does SQL Server support consistency transaction on XML? (I'm using ASP.NET Web API)

In my use case, the entity Project has an attribute TaskTree,
which saves the concrete task structure of the Project.

The datatype of TaskTree is XML. (umm, I'm also wondering how I pass a xml within JSON response...)

So the main problem is:

For short:

enter image description here

Any of the modification request to the TaskTree need a long time to modify XML file.
If there are many people request to modify the TaskTree at the same time,
Can all the input/output to the XML file be consistent in SQL SERVER?

Thanks.

OOD Waterball
  • 618
  • 8
  • 23
  • 1
    This depends how you are modifying it. Please add more information. Do you modify it somehow inside SQL Server? Or just send the modified data to it? – Sami Kuhmonen Aug 02 '17 at 02:34
  • I think first I get the xml file from SQL Server then **modify it in asp.net** finally send the modified data back. – OOD Waterball Aug 02 '17 at 02:35
  • Then whatever you send there last is stored there. If another request gets the data and modifies it while another does the same then only the last one remains. SQL Server doesn't change things in any way, you'll have to handle concurrent edits in your application. – Sami Kuhmonen Aug 02 '17 at 02:37
  • thanks , so this should be handled in ASP.NET .. – OOD Waterball Aug 02 '17 at 02:40
  • Everything is completely consistent. What case do you need to handle? When two people are editing a record at the same time? If you are storing data structures as XML inside SQL Server you're in for a world of pain if you want to edit / report on individual elements inside individual records – Nick.McDermaid Aug 02 '17 at 02:43
  • Yes, there might be several people modifying one **XML element** or any of the **attribute** at the same time... – OOD Waterball Aug 02 '17 at 02:52
  • In your case I would not use an XML for this. *XML is not meant to store changing data*, especially if data **within** the XML is used separately. This design is breaking 1.NF! XML is fine, if it is *one piece of information*. Read [this related answer](https://stackoverflow.com/a/43495014/5089204) – Shnugo Aug 16 '17 at 07:54

0 Answers0