I have a scenario in which I have to process multiple .sQL
files, every file contains 3-4 insert or Update queries, now when any query in a file fails I do rollback
whole transaction means whole file we be rolled back , and all other files executed before that file will get committed, I want an option where user can rollback
entire transaction means all queries in a file executed and all files executed before that particular file containing error, and if user wants to skip that particular file with error we will just rollback
single file which contains error all other files will get committed, I am using SQL Transaction right now , no TransactionScope
but obviously I can switch too TransactionScope()
if needed and possible,
Currently pseudo for my code (what i want) is as follows
Var Files[]
for each (string query in Files)
{
Execute(Query)
IF(TRUE)
CommitQuery()
Else
result=MBOX("IF You want to abort all files or skip this one")
if(result=abort)
rollbackall()
else
QueryRollBack()
}