Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gtaro
Starting Member
1 Post |
Posted - 2006-09-29 : 16:53:02
|
Hey guys. I had to write this script to clean up some bad data but I am trying to put some rollback code but for my life I dont remember how.. Its been a while.. Please help.. I've included a good chunk of the script. There is a stored procedure that runs at the end of the script that updates a history table. There are about 25 Update and Set commands like you see below. I just included one for understanding. PLEASE HELP--Clean up null dates and F.C.ID.Declare @guid uniqueidentifierSet @guid = '5DD72C81-18AD-4540-868E-CD84D1FAD229'begin transactionUPDATE dbo.PaymentDtlSET FacilityOrganizationId = '389', EffectiveDt = '1/5/2006 12:00:00 AM',UpdatedByPersonnelId = '2290', updateddt = getdate(), lastupdatedguid = @guidWHERE PaymentDtlId = '4003314')EXEC dbo.up_PaymentDtlHistoryAddByLastUpdatedGuid @guid, 6, ‘Fix UI Error’rollback work |
|
Kristen
Test
22859 Posts |
Posted - 2006-09-29 : 19:16:43
|
The syntax isBEGIN TRANSACTION... do stuff ...then either:ROLLBACKorCOMMITKristen |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|