Suppose we have an Employee Table with these ID ,Name, DeptID, Status and Salary fields.
BEGIN TRAN
TRUNCATE TABLE Employees
ROLLBACK
SELECT * FROM Employees
Suppose we have an Employee Table with these ID ,Name, DeptID, Status and Salary fields.
BEGIN TRAN
TRUNCATE TABLE Employees
ROLLBACK
SELECT * FROM Employees
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit MohantyRank #112 · 20K reputationPosted Feb 28, 2023, 8:28 AM EST
The query first starts a transaction using BEGIN TRAN, then truncates the Employees table using TRUNCATE TABLE. However, because the transaction is rolled back using ROLLBACK, any changes made to the table during the transaction are undone and the table is restored to its original state.
So it returns result set of all records in the Employees table.
Sachin SinghRank #66 · 26.2K reputationPosted Mar 1, 2023, 9:47 AM EST
You will get all rows,
No row will be deleted, transaction will roll-back.
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 1, 2023, 11:15 PM EST
Hello Rajeev,
Nothing will happen in above query as you are doing rollback after transaction
Alpesh ManiyaRank #832 · 2.7K reputationPosted Mar 1, 2023, 9:19 AM EST
Truncate can't be a rollback, If you have delete a statement then you can rollback.