undo changes on table in database
-
my application has the following procedure. a database of products (20,000 rows) exists. our client has 'import' feature where he imports an excel file. this is implemented by deleting all products table rows, then doing the import - which is a long thing since we programmatically performing calculations on the data. the obvious problem is if the 'import' action fails (IO stuff), they now have none/partial/curropt data in the products table. We wish that if the 'import' operation fails, the original data remains. this is ASP.NET application, written in C#, using SQL Server 2005 and using XSD which we created through the VS2005 design tools.
-
my application has the following procedure. a database of products (20,000 rows) exists. our client has 'import' feature where he imports an excel file. this is implemented by deleting all products table rows, then doing the import - which is a long thing since we programmatically performing calculations on the data. the obvious problem is if the 'import' action fails (IO stuff), they now have none/partial/curropt data in the products table. We wish that if the 'import' operation fails, the original data remains. this is ASP.NET application, written in C#, using SQL Server 2005 and using XSD which we created through the VS2005 design tools.
-
my application has the following procedure. a database of products (20,000 rows) exists. our client has 'import' feature where he imports an excel file. this is implemented by deleting all products table rows, then doing the import - which is a long thing since we programmatically performing calculations on the data. the obvious problem is if the 'import' action fails (IO stuff), they now have none/partial/curropt data in the products table. We wish that if the 'import' operation fails, the original data remains. this is ASP.NET application, written in C#, using SQL Server 2005 and using XSD which we created through the VS2005 design tools.
- Make a copy of the table that the stuff gets imported to. Ensure that this table is empty. 2) Import all your stuff to the secondary table 3) If there are no exceptions then delete everything in the original import-table, and copy all stuff from the secondary table to the import-table. If an exception did occur, the original import-table will still hold all data. You could also use transactions to achieve a similar functionality. SQL Server caches all changes that way, in order to 'undo' them. I don't know which of these options would serve you best. The transaction-approach would probably be faster to implement.
I are troll :)