Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Fallback script for an INSERT/UPDATE script. Expand / Collapse
Author
Message
Posted Friday, June 15, 2012 8:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 30, 2013 11:36 AM
Points: 4, Visits: 56
Hi!

=> My problem
Despite the XACT_ABORT statement in a specific script I've written my client asked me for a "fallback script".
I've never heard the word "fallback"* before! I've never read something concerning fallback strategies.
Important: I cannot restore any backup to a point before the execution of my script because it will certainly make me lose data in the production environment.

=> My questions:
1) Does it exist a strategies for fallback after the execution of insert/update scripts?
2) Does it exist objects in the database able to provide some helpful information in order to "undo" the data changes done by the script?

=> My scenario
I use to insert and update data into tables by creating simple scripts under the following structure:

USE mydb;
GO

SET XACT_ABORT ON;
GO

BEGIN TRAN T1;
GO

/* SQL statements */

COMMIT TRAN T1;
GO

I'm developer and I never have access to the client's production database.
Then I use XACT_ABORT set to ON for every script I create and put my statements in a transaction even when my script does work perfectly in my development database. This practice avoids a lot of problems that a partial execution of my scripts may cause.

Ok, I'll try to create manually a set of statements in order to provide this "undo script" my client asked me today.
However does someone have any sugestion of a good practice or a book concerning this issue?
Thank you all in advance!

* I'm not native English speaker but, as you can see, it's not a matter of semantincs!
Post #1316697
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse