
Depending on the current transaction isolation level settings, many resources acquired to support the Transact-SQL statements issued by the connection are locked by the transaction until it is completed with either a COMMIT TRANSACTION or ROLLBACK TRANSACTION statement. Each transaction lasts until either it completes without errors and COMMIT TRANSACTION is issued to make the modifications a permanent part of the database, or errors are encountered and all modifications are erased with a ROLLBACK TRANSACTION statement.īEGIN TRANSACTION starts a local transaction for the connection issuing the statement. 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. General RemarksīEGIN TRANSACTION represents a point at which the data referenced by a connection is logically and physically consistent. WITH MARK allows for restoring a transaction log to a named mark. If WITH MARK is used, a transaction name must be specified. A description longer than 128 characters is truncated to 128 characters before being stored in the table. description is a string that describes the mark. Specifies that the transaction is marked in the log.

If more than 32 characters are passed to the variable, only the first 32 characters will be used the remaining characters will be truncated. The variable must be declared with a char, varchar, nchar, or nvarchar data type. Is the name of a user-defined variable containing a valid transaction name. transaction_name is always case sensitive, even when the instance of SQL Server is not case tran_name_variable

Use transaction names only on the outermost pair of nested BEGIN.COMMIT or BEGIN.ROLLBACK statements. transaction_name must conform to the rules for identifiers, but identifiers longer than 32 characters are not allowed. ArgumentsĪpplies to: SQL Server 2008 (10.0.x) and later, Azure SQL Database To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
