Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
We have a legacy application that runs on an AS/400. One of the applications we have allows users to key a batch of transactions and then post them to a ledger. In the AS/400 application we would backup the data that was being posted and the ledger files prior to the post. Then if something is wrong with the data in the batch, the end user has the ability to restore the files and reverse the post of the batch.
 
I am not seeing an easy translation of this to SQL server. It seems like an ugly requirement, but our users have been spoiled by it in the legacy application.
 
Any suggestions about how to accomplish this in a Visual Studio/SQL Server environment.
Posted 1-May-13 3:07am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Firstly into using tranactions - http://www.sqlteam.com/article/introduction-to-transactions[^] and the microsoft documentation here http://msdn.microsoft.com/en-us/library/ms174377.aspx[^]
 
However, you seem to be implying that the user can make this choice for themselves (compared to something going wrong during the load) so you may want to use triggers to store away the pre-post data onto another table - micosoft documentation here http://msdn.microsoft.com/en-gb/library/aa258254(v=sql.80).aspx[^].
 
You could just copy the entire table to another "backup" table prior to the load but I wouldn't recommend it (impact of multiple users, performance etc).
 
Some research into the Memento Design pattern may also prove useful - here's an example article
Memento Design Pattern[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 1 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100