-->

Is TRUNCATE TABLE transactional ?

Post a Comment
1: CREATE TABLE tTest ( i INT )  
2: INSERT tTest ( i ) VALUES( 1 ) 
3: INSERT tTest ( i ) VALUES( 1 ) 
4: INSERT tTest ( i ) VALUES( 1 ) 
5: INSERT tTest ( i ) VALUES( 1 ) 
6: 
7: BEGIN TRAN 
8:  TRUNCATE TABLE tTest 
9:  SELECT * FROM tTest 
10: ROLLBACK 
11: 
12: SELECT COUNT(*) FROM tTest 
13: DROP TABLE tTest 
14: 
15: 


So, yes - it is subject to the transaction; also - it is a logged operation, its just that the individual rows are not logged "individually" like they would if you used DELETE.

Related Posts

Post a Comment

Subscribe Our Newsletter