vidhya Narayanan

Greenhorn
+ Follow
since Apr 08, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vidhya Narayanan

"create table table_backup as select * from table"
this creates the new table with the same structure but not with the key constraints..
How to get the keys and constraints in the same sql stmt.

Paul Sturrock wrote:

vidhya Narayanan wrote:

Jhakda Velu wrote:Since you said you have more than 1 sql, i presume you want to do an atomic transaction. We normally commit after successful completion of all transactions, roll back otherwise.

Jhakda

can i use rollback for DDL ... i think we cant... but wanted to know whether ther is any other method for doing it



DDL is usually not transactional, so no.



I have a method to perform a rollback on the ddl statements. A method with all alter commands. This works fine if there is any error in the end of the actual code. If the actual code fails in-between the rollback method is called but the issue is there is an error while the alter stmts execute that were not created at all. Can anyone help me.

Jhakda Velu wrote:Since you said you have more than 1 sql, i presume you want to do an atomic transaction. We normally commit after successful completion of all transactions, roll back otherwise.

Jhakda

can i use rollback for DDL ... i think we cant... but wanted to know whether ther is any other method for doing it

Thank u. I have another doubt o use the same connection for all the statements.. should i commit each after each stmt or i can commit at the end .
And can i use commit after the rollback?

wei liu wrote:

Arpit Panwar wrote:Make sure you change the Storage engine of your table to InnoDB
I think the default engine MyISAM doesnt support Transactions
Try it and let me know



Thanks Arpit, It works after change the engine from MyISAM to InnoDB.

Thanks for your help.

Hi .. i too have the same problem. here in this case there is only one sql stmt... i have a set of updates and deletes .. and if i use the roolbak will it work?... thanks in advance

I too have the same problem.I have a set of tables where i will perform n number of updates and deletes. If i use this rollback() , will i get the previous values that were present?