Abhijeet
Abhijeet

Reputation: 111

Can we call truncate command in trigger command using sql server?

Can we possible to call truncate command inside trigger using sql server?

Upvotes: 0

Views: 74

Answers (1)

SQLpro
SQLpro

Reputation: 5131

TRUNCATE command is a transactional command and all the pages deleted will be writed into the transaction log. And because the trigger code is envolved in a transaction, you can ROLLBACK or COMMIT the implicit transaction into the trigger code (COMMIT is not a good practice into trigger code).

So, yes, you can !

Upvotes: 2

Related Questions