Can we rollback the truncate statment and what is the difference?
Q: Can we rollback the truncate statment? whats the difference between delete and truncate?
Kevin Kline says: You cannot rollback TRUNCATE. It is a “non-logged statement”. TRUNCATE removes ALL records from a table.
You -can- rollback DELETE. It is a “logged statement”. DELETE removes one or more records from a table according to the conditions of your WHERE clause.
My recommendation is not to use TRUNCATE in a production application since you cannot recover from it. Instead, use DELETE unless you have a very strong reason to use TRUNCATE.
Technorati Tags:
SQL Server, database operations, truncate, rollback