Roll back a lab change
Compare a temporary row before and after a rolled-back update.
What you are trying to do
A reviewer wants to see the effect of an update without keeping the changed value.
Work through it
- Confirm that the target is a local temporary table.
- Read the row before the transaction.
- Compare the row after rollback with its original value.
Check your work
The temporary row returns to its original state and the table is removed.
Practice SQL
Open in SQL FlowCREATE TABLE #LabQueue (ItemId int PRIMARY KEY, State nvarchar(12) NOT NULL); INSERT INTO #LabQueue VALUES (1, N'Queued'); BEGIN TRANSACTION; UPDATE #LabQueue SET State = N'Ready' WHERE ItemId = 1; SELECT ItemId, State FROM #LabQueue; ROLLBACK TRANSACTION; SELECT ItemId, State FROM #LabQueue; DROP TABLE #LabQueue;
Commands in this lesson
Next lesson Read a backup inventory