I've a bit of a messy situation where an SP #1 calls SP #2 which calls SP #3. I found a bottleneck in #3 under certain conditions which was leading to a timeout so #3 was only completing half its work. I did away with a view that it was using and read directly from the table which reduced execution time drastically and chances have improved that it won't happen again. If however it did happen again, and #3 timesout, I'd like to be able to roll back all the work done in sp 1,2 and 3.
I'm pretty inexperienced with Sql, is this just a case of putting #1 in a transaction which will wrap around everything or does having nested sp's change the approach? If anyone has any good links to what I'm trying to do that would be great