Xml data as history of records SQL Server



I have one xml column in sql server where I store actual value and immediate previous value of attributes



<attribute name="Name">
<actuals>
<element isPreferred="true" name="FirstName">Name 2</element>
<element isPreferred="false" name="LastName">N2</element>
</actuals>
<previous>
<element isPreferred="true" name="FirstName">Name 1</element>
<element isPreferred="false" name="LastName">N1</element>
</previous>
</attribute>


How can I show the history of attribute like



------------------------------------
Attribute | New Value | OldValue
------------------------------------
First Name| Name2 | Name1
Last Name | N2 | N1
------------------------------------

No comments:

Post a Comment