Solved

Need of using BeginTrans and CommitTrans

Posted on 2000-04-02
2
439 Views
Last Modified: 2012-06-27
Hi.... why cannot I executed a SQL statement without enclosing it by BeginTrans and CommitTrans instructions? what do they really do?

Thanks
Skel
0
Comment
Question by:skel
2 Comments
 

Expert Comment

by:chsoh
ID: 2678774
The main purpose of transaction is make data isolation so that multiple users can access data simultaneously without interfering with one another.

When you execute a SQL begin with BeginTrans, you MUST execute the CommiTrans or RollbackTrans to either make the transaction success or Undo the transaction.

This is becoz when you execute the BeginTrans, all the statements & instruction under BeginTrans will be keeped & recorded before it actually done on database. The statements between BeginTrans and CommitTrans will be actually done after the CommitTrans statement, or cancelled if RollbackTrans.

anythings need to know ?
0
 
LVL 4

Accepted Solution

by:
srikant033100 earned 50 total points
ID: 2679431
Hi
Skel
You actually need a begin Trans to tell to the RDBMS that it is actuall starting a new transaction and it is very important to maintain the consistencies of data. Untill u start with a begin trans or end with an commit or rollback it is very difficult to maintain the database at a consistent and accurte level. That is why every transaction or else a set or action which together we call as transaction has to start with a begin trans and end with end trans or rollback with rollback.

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question