Be aware that truncate can be rolled back if you do so before the transaction is committed but if you inadvertently do it to the wrong table and find out later, it may not be possible to recover from the transaction logs. Do not do this on a production machine unless you have a current backup. Also this is not a command you want to allow to run from the user interface. This is a very dangerous command and should not be run by anyone except a dba. If users need to delete all records it is far safer (but slower) to use
Code:
delete tablename
"NOTHING is more important in a database than integrity." ESquared
You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint; instead, use DELETE statement without a WHERE clause. Because TRUNCATE TABLE is not logged, it cannot activate a trigger.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.