Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mattt
Posting Yak Master
194 Posts |
Posted - 2008-02-13 : 10:46:18
|
| Hi,I have a situation where a user can take some data pulled from the DB and change it - records can be added, records can be removed and the order in which the records appear can be changed.This is then sent back to the server, through the interface, in the form of XML. I have a query which uses openxml to change the XML back into a temp table.What I need to be able to do is compare the two datasets and find out which records have changed so that I can update the audit information for those records. Anyone advise me on how to do this?Cheers,Matt |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-02-13 : 11:12:34
|
| Would this be a situation where only 1 person is completing this task or could potentially multiple users do this simultaneously?Jack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
mattt
Posting Yak Master
194 Posts |
Posted - 2008-02-13 : 11:14:09
|
| Potentially multiple although it has to be said it would be EXTREMELY unlikely for this to happen. So if there's a big saving to be made in terms of efficency/complexity I'm happy to take the risk. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-13 : 12:17:50
|
| I think you can put the two datasets onto two temp tables and compare data between them.Suppose OldTable is table containing data pulled by userand NewTable contains data after user has made chage (temp table from XML).Now you can compare these two tables and update audit info1. records present in new table not in old-newly insert (INSERT action)2.records present in old but not in new table (DELETE action)3.records present in both tables with different attribute values (UPDATE action)once you get this,update this action info onto the audit table.Hope this was what you were asking. |
 |
|
|
|
|
|