Luke101
Luke101

Reputation: 65288

Can DML and DDL statements be in a transaction together

I would like to create a table and perform an insertion all in one transaction. Can this be done in MySQL?

Upvotes: 0

Views: 2088

Answers (2)

Kermit
Kermit

Reputation: 34063

According to MySQL:

Some statements cannot be rolled back. In general, these include data definition language (DDL) statements, such as those that create or drop databases, those that create, drop, or alter tables or stored routines.

Documentation

Upvotes: 1

ESG
ESG

Reputation: 9425

No, MySQL (well, InnoDB) does not support transactions for DDL statements.

Upvotes: 0

Related Questions