Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:09:53+00:00 2026-05-11T05:09:53+00:00

I want to run an update query against a production database and as good

  • 0

I want to run an update query against a production database and as good little developer I am trying to make it as safe as possible. I am looking to do the following

BEGIN TRANSACTION     UPDATE table_x SET col_y = 'some_value'     .     .     . IF (@@error <> 0) BEGIN     ROLLBACK END ELSE BEGIN     COMMIT END 

The above should work in SQL Server but I need this to work against a MySQL database.

EDIT: Sorry, there is more than 1 statement to execute. Yes I am aware of not needing to wrap a single query in a transaction.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:09:54+00:00Added an answer on May 11, 2026 at 5:09 am

    I don’t think this is necessary as there is the concept of implicit commit/rollback.

    From MySQL docs:

    By default, MySQL starts the session for each new connection with autocommit mode enabled, so MySQL does a commit after each SQL statement if that statement did not return an error. If a statement returns an error, the commit or rollback behavior depends on the error. See Section 13.6.13, “InnoDB Error Handling”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run an update query. The query will be run against multiple
hi want to run a query like this: UPDATE `stories` SET `position`=(select @i:=@i+1) WHERE
I'm trying to run a very quick update query to record that a user's
Can I run an update query and in one single field run multiple updates
what I am trying to do is run a query multiple times over multiple
I want to run a query like this: SELECT * FROM Studio WHERE Id
I want to create an android application that can run SQL Query to my
Possible Duplicate: Access Auto-Increment Value During INSERT INTO Statement I want to run an
I have something like 40K rows and i must run update query like this:
I'm having problems updating a mysql database. I want to run this script on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.