Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between tran and transaction in SQL Server 2005

Tags:

What is difference between tran and transaction in SQL Server 2005 ?

Following are two statements

Begin Tran Begin    .........    ......... End Rollback 

OR

Begin Transaction Begin     ......    ...... End Rollback 
like image 785
Ali Avatar asked Mar 05 '12 10:03

Ali


People also ask

Why we use begin Tran in SQL?

BEGIN TRANSACTION represents a point at which the data referenced by a connection is logically and physically consistent. If errors are encountered, all data modifications made after the BEGIN TRANSACTION can be rolled back to return the data to this known state of consistency.

What is commit Tran in SQL?

The COMMIT command is the transactional command used to save changes invoked by a transaction to the database. The COMMIT command saves all the transactions to the database since the last COMMIT or ROLLBACK command.

How many types of transactions are there in SQL?

SQL Server can operate 3 different transactions modes and these are: Auto-commit transactions. Implicit transactions. Explicit transactions.


1 Answers

There is no difference. TRAN is merely an allowed abbreviation, as can be seen from the documentation:

Syntax

BEGIN { TRAN | TRANSACTION }      [ { transaction_name | @tran_name_variable }       [ WITH MARK [ 'description' ] ]     ] [ ; ] 

The { | } in this syntax description means 'pick one of these two alternatives'

like image 180
AakashM Avatar answered Jan 17 '23 23:01

AakashM