Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql transactions

Status
Not open for further replies.

Laeg

Programmer
Nov 29, 2004
95
IE
I'm using the following client SQL Manager Lite to query a mysql db.

I am running queries on a database that I am just familiarising myself with so I am trying to see the effect of running various queries PRIOR to running them with a commit.


begin transaction
update tblFoo set x = 1 where y = 2
rollback transaction


This is plucked straight from my MSSQL 2K experience, is there an MySQL equivalent as this gives me an error
 
It depends on what version of mysql you are using whether it supportrs transactions or not.
If your just having a play take the begin and rollback statements out and that query should work.
Mysql has other users for begin so it implelents (but ignores in early versions) the start transaction statement
 
start transaction;
update tblFoo set x = 1 where y = 2;
rollback;

is what I was looking for.

This makes the change to tblFoo and then rolls it back. In my client then I can see how many rows were affected by the UPDATE statement and if it tallied with expected results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top