I want to store in SQL Server 2008 XML files, but in a way that versioning is supported. For example, I have a XML document and I save it in the DB(in the XML datatype column). After that, I edit it. Let's say a add a new node. What I want to keep is the edited document (last version of the document) and the modifications, so I can revert any time I want to a previous version of the same document.
Where is the best place to compare the version I edited (which will be the last version if I save it) with the previous version (the last version stored in the DB before begining to edit it) in order to store the differences between these two? At the server side or can I do it somehow at the DB level? Can you provide some guidelines or best practices for this scenario?