SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Fallback script for an INSERT/UPDATE script.


Fallback script for an INSERT/UPDATE script.

Author
Message
Michel M.
Michel M.
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 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!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search