Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 solution

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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900