Search code examples
sqltransactionsdrop-table

SQL Server: Does 'DROP TABLE' inside transaction causes an implicit commit?


My question is kind of easy but i'm still doubting after I created this transaction. If I execute the following code:

BEGIN TRANSACTION
      DROP TABLE Table_Name

Can I perform a ROLLBACK TRANSACTION that recovers the dropped table? I'm asking because I don't know what happens in the 'Object Explorer' and I didn't found any question of this topic, so I think that it could be a useful issue.


Solution

  • DROP TABLE can be rolled back and it does not auto-commit.