Reputation: 111
Can we possible to call truncate command inside trigger using sql server?
Upvotes: 0
Views: 74
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