Skip navigation

Rolling Back a Transaction in the Transaction Log File

Downloads
25296.zip

How can I use T-SQL to roll back the one transaction (for example, ID 0000:0010a183) that I found in the transaction log file?

To prevent data corruption, SQL Server doesn't support the rollback of individual transactions. For example, let's say that two transactions, T1 and T2, use a cash balance field. T1 adds USD 500, and T2 makes a change by using that new value. If you then roll back T1, T2 might be wrong. However, you can restore a log to a predefined mark or a point in time by using timestamps, as Listing 1 shows, or transaction log marks, as Listing 2, page 50, shows.

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish