Skip to content

Instantly share code, notes, and snippets.

@alinciuca
Created January 30, 2019 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alinciuca/65b6ab7a4f90735f7e1945488383afbe to your computer and use it in GitHub Desktop.
Save alinciuca/65b6ab7a4f90735f7e1945488383afbe to your computer and use it in GitHub Desktop.
select count (*) as BeforeTruncateCount
from TableName;
declare @Transaction varchar(20) = 'Transaction1';
begin tran @Transaction
truncate table TableName;
select count (*) as AfterTruncate
from TableName;
rollback tran @Transaction;
select count (*) as AfterRollback
from TableName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment