Doubt in Begintrans - Rollback - Committrans

Asked

Viewed 107 times

0

Good Morning,

I have some questions related to Transaction Control: Begintrans - Rollback - Committrans.

Currently I was using in VB6 and questions arose: 1 - Transaction controls when performing a Rollback, returns table structure? * for example: I run a DROP TABLE, CREATE TABLE in the same Transaction, and some error occurs when running Rollback, deleted tables are restored/ and created tables are deleted?

2 - When Opening a Transaction where all transactions are executed before persisting in bank (Comminttrans) ? Any log files?

Thank you very much.

1 answer

0


Ariel,

Not every command allows roolback, you should look at the documentation of the database you are using. For example, in Mysql:

http://dev.mysql.com/doc/refman/5.0/en/implicit-commit.html

CREATE TABLE and DROP TABLE statements do not commit a transaction if the TEMPORARY keyword is used. (This does not apply to other Operations on Temporary Tables such as ALTER TABLE and CREATE INDEX, which do cause a commit. ) However, Although no implicit commit occurs, neither can the statement be Rolled back, which Means that the use of such statements causes Transactional atomicity to be violated. For example, if you use CREATE TEMPORARY TABLE and then roll back the transaction, the table remains in Existence.

This means that by default they cause commit, but can be circumvented with the TEMPORARY clause.

For the second question, I don’t know any transaction logs. The transaction itself, consisting of saving a state of your database, there would be no reason to have a log, at least from my point of view.

I hope I’ve helped!

  • Thank you very much Celso, helped and very much. I am using sql Server 2008, I will search the documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.