Wednesday, December 29, 2010

Truncate Within A Transaction

In the previous post, we have seen, what is the difference between in “Truncate vs. Delete”?

Actually if we use truncate then we can’t rollback the data, but the question is … What will happen if we use truncate within a transaction, Whether we can rollback or not?.

The following example reveals the answer for our question.

I created a table and inserted a rows, as shown below

Then I executed the below Query:

It Returns:

Truncated Data can be roll backed if it is executed within a transaction

No comments:

Post a Comment