sys.sp_bindsession

general
#stored-procedure

Description

Binds or unbinds a session to other sessions in the same instance of the SQL Server Database Engine. Binding sessions allows two or more sessions to participate in the same transaction and The token that identifies the transaction originally obtained by using This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Syntax

sp_bindsession {
'bind_token'
|
NULL
}

Examples

Example 1

SELECT

Example 2

sp_bindsession

Example 3

sp_getbindtoken

Example 4

sp_bindsession

Example 5

sp_bindsession

Example 6

--COMMIT TRANSACTION;
--COMMIT TRANSACTION;
Token1
------
PKb'gN5<9aGEedk_16>8U=5---/5G=--
Token2
------
PKb'gN5<9aGEedk_16>8U=5---/5G=--

Example 7

DECLARE
@bind_token
AS
VARCHAR (255);
BEGIN
TRANSACTION
;
EXECUTE sp_getbindtoken @bind_token
OUTPUT
;

Example 8

SELECT
@bind_token
AS
Token;
--COMMIT TRANSACTION;
Token
-----
\0]---5^PJK51bP<1F<-7U-]ANZ