Showing posts with label Transactions. Show all posts
Showing posts with label Transactions. Show all posts

Friday, August 6, 2010

Simple Questions on Transactions

A transaction is a group of statements that are combined into a single logical unit. All statements succeed as a whole, or if any one of the statement fails, they all fail as a whole.

BEGIN TRAN --> Marks the starting point of a transaction.
SAVE TRAN Save_point --> Sets a new save point with in a transaction.
COMMIT TRAN --> Marks the end of a transaction and makes the changes permanent.
ROLLBACK [TRAN] [Save_point] --> Rolls back a transaction to the starting point or to the specific save point.



1. The following script if executed, what will be the output if you have only 200 Rupees?

IF Cash > 200
   'Buy Fruits'
   'Buy Snacks'

(a) Buy Fruits, Buy Snacks.
(b) Buy Snacks.
(c) None of the statements will execute.


2. The following script if executed, what will be the output you have only 200 Rupees?

IF Cash > 200
    BEGIN
        'Buy Fruits'
        'Buy Snacks'
    END

(a) Buy Fruits, Buy Snacks.
(b) Buy Snacks.
(c) None of the statements will execute.


3. Which one of the following function returns the open transaction count?

(a) @@ERROR
(b) @@FETCH_STATUS
(c) @@TRANCOUNT
(d) @@ROWCOUNT


4. Consider using nested transactions, if any one transaction rollbacks what will happen to other transactions with in the nesting?

(a) All other transactions will be committed except the one which rollback.
(b) All the transactions will be rollback regardless of the nesting level.
(c) None of the transactions will execute.
(d) Creates open transactions.


5. An open transaction prevents others from viewing the data that is modified, which command can be used to make the modifications permanent?

(a) UPDATE TRAN
(b) DELETE TRAN
(c) SELECT TRAN
(d) COMMIT TRAN


6. When using a TRY…CATCH block, which function helps to find out the description of the error?

(a) ERROR_SEVERITY
(b) ERROR_STATE
(c) ERROR_MESSAGE
(d) ERROR_NUMBER


Show Answers: