I m looking for a way to continue execution of a transaction despite errors while inserting low-priority data. It seems like real nested transaction could be a solution, but they aren t supported by SQL Server 2005/2008. Another solution would be to have logic to decide if an error is critical or not, but it would seem that s not possible either.
Here s more detail on my scenario:
Data is periodicaly inserted in the database using ADO.NET/C#, and while some of it is vital, some could also be missing without problems. When the inserts are done, some computations are made on the data. (Both vital and non-vital) This whole process is inside a transaction so everything remains in synch.
Currently, transaction save points are used, and partial rollbacks are made on exceptions which occur during non-vital inserts. However, this doesn t work for "batch-abort" errors, which automaticly rollback the entire transaction. I understand some errors are critical, but things like failed casts are considered by SQL Server to be batch-abort errors. (Info on batch errors) I m trying to prevent these errors from bringing down the whole insert if they occur on low priority data.
If what I m describing isn t possible, I m willing to consider any alternative way to achieve data integrity but allow the failure of the non-vital inserts.
Thanks for your help.