Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:08:34+00:00 2026-05-27T04:08:34+00:00

I am trying to find a method to rollback a transaction after it has

  • 0

I am trying to find a method to rollback a transaction after it has been executed.

For example:

DECLARE @tsubaki VARCHAR(25);
SET @tsubaki = 'A Transaction';

BEGIN TRANSACTION @tsubaki
UPDATE dbo.Maka SET id = 400, name = 'inu' --notice I didn't put there where clause
COMMIT TRANSACTION

Later on I realize that I updated everything in the databse Maka instead of just the one record I originally intended.

Now I try to write code to roll it back before the update:

DECLARE @tsubaki VARCHAR(25);
SET @tsubaki = 'A Transaction';
ROLLBACK TRANSACTION @tsubaki;

Doesn’t work. Bottom line: I am looking for a way to rollback a sql transaction in MS-SQL Server 2008 after the transaction has been commit and the sql has ran.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:08:34+00:00Added an answer on May 27, 2026 at 4:08 am

    You can’t do that from T-SQL code. You will have to restore to a point in time from the log file. Note that the restore will “undo” everything to a point in time, including your transaction.

    In the future you should ALWAYS back up your db before any manual update, small or large. You can also cover yourself with a little trick. Write out your update/delete code like this:

    SELECT * FROM dbo.Maka
    -- UPDATE dbo.Maka SET id = 400, name = 'inu'
    WHERE some_identifier = some_value
    

    Run the SELECT version first which is innocuous and when you can verify the record(s) to be updated select the code from the WHERE clause up to the UPDATE and run it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've been trying to find a method in C# to measure the size of
I have been trying to find the simplest method (in XAML) to bind a
I have been trying to find a method that computes the magnitude of a
Trying to find a good name for a method swapping each coordinate X and
I'm trying to implement method Find that searches the database. I forgot to mention
I'm trying to find a way to fake the result of a method called
I'm trying to find the jQuery equivalent of this JavaScript method call: document.addEventListener('click', select_element,
I'm trying to write (or just find an existing) PHP method that can take
I'm trying to check if a find method returns a result. My find method
I'm trying to find a way in which I can return a generic set,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.