Quantcast
Channel: Microsoft Dynamics GP
Viewing all articles
Browse latest Browse all 59474

Blog Post: Rollback your SQL script w/o restoring the database

$
0
0

Have you ever had to update a table in GP and made a mistake. No! Never right? Then had to restore the database to bring it back before you ran the statement.  Dang!! I forgot to make a backup! How many times have you had to restore before getting it right?

ptg02205064

Well there is in SQL the Rollback and Commit Statements to help rollback your changes in case of the OOPS!! or in case you forgot to back-up the database. Then you Commit in case you are perfect. For a few seconds more, you can save a time and heartache.

 

Example :

  – How to not commit changes in your database until you are sure it works and can roll back the changes without doing  a restore of the database.

–Below is an example of an Update Set command that can be rolled back in case of OOPS!!

– Uses a Specific Database

– Step One

Select * RM00101 where ChekBKID=’Main’

–check the number of rows for transactions

 

– Step Two

Begin Tran

Update RM00101 Set ChekBkId=’New’ where ChekBkId=’Main’

– check the number of rows for transactions to make sure it matches your first select statement

– you can run the select statement again by just highlighting it and make sure it is ’0′ rows and no data.

 

– Step Three or Four

Commit

–run this if everything works great

 

Rollback

– run this if you did something wrong OOPS

 

 

Post to TwitterPost to Yahoo BuzzPost to DeliciousPost to DiggPost to FacebookPost to LinkedInPost to MySpacePost to Ping.fmPost to RedditPost to StumbleUpon

The post Rollback your SQL script w/o restoring the database appeared first on Rose Business Solutions Dynamics GP.


Viewing all articles
Browse latest Browse all 59474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>