sql server - How to convert a transaction SQLServer to MySQL -
use[otahara] begin transaction trans1 --código sql insert cities (name) values ('teste 1') update customers set idcity = 20 id = 1 if (@@error <> 0) begin rollback raiserror('erro fidapu', 16, 1) end else begin commit end; -- selects select * cities select * customers id = 1
=============================================================
use[otahara] declare @idcity int = 0; begin transaction trans1 --código sql insert cities (name) values ('teste 2') select @idcity = @@identity; update customers set idcity = @idcity id = 1 if (@@error <> 0) begin rollback raiserror('erro fidapu', 16, 1) end else begin commit end; -- selects select * cities select * customers id = 1 delete cities id = 18;
=============================================================
Comments
Post a Comment