Returns the binary version of the gtrid component of an ASCII XA transaction ID.
xa_gtrid(xactname, int)
1> select xa_gtrid("0000000A_IphIT596iC7bF2#AUfkzaM_8DY6OE0", 0) 2> go
... -------------------------------------------------------------------------- 0xb1946cdc52464a61cba42fe4e0f5232b (1 row affected)
1> select gtrid=xa_gtrid(xactname,0), bqual=xa_bqual(xactname,0) from systransactions where coordinator = 3 2> go
gtrid bqual -------------------------------------------------------------------------- 0xb1946cdc52464a61cba42fe4e0f5232b 0x227f06ca80
If an external transaction is blocked on the SAP ASE server and you are using sp_lock and sp_transactions to identify the blocking transaction, you can use the XA transaction manager to terminate the global transaction. However, when you execute sp_transactions, the value of xactname it returns is in ASCII string format, while XA Server uses an undecoded binary value. Using xa_gtrid thus allows you to determine the gtrid portion of the transaction name in a format that can be understood by the XA transaction manager.
xa_gtrid returns:
The translation version of tis string that follows the first “_” (underscore) and preceeds either the second “_” or end-of-string value, whichever comes first.
NULL if the transaction ID cannot be decoded, or is in an unexpected format.
See also sp_lock, sp_transactions in Reference Manual: Procedures.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can use xa_gtrid.