A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

xa_gtrid()

The system function xa_gtrid() returns the "global transaction id" component of a ASCII transaction id in binary format. This is required if an external transaction in ASE is blocked in a system with distributed transactions. The blocking transaction can be identified using the stored procedures sp_lock and sp_transaction and eventually termniated using the "XA Transaction Manager". But the stored procedures sp_lock and sp_transaction only return the value of the xactname in ASCII format, whereas the "XA Transaction Manager" expects a value in binary format. So the function xa_gtrid can be used to determine the respective global transaction id (gtrid) of a transaction in the right format for the "XA Transaction Manager". The return value of the function xa_gtrid can be NULL, if the transaction id cannot be decoded, or if it is specified in an invalid format. xa_gtrid is often used in connection with the function xa_bqual(). The function is a T-SQL extension. It can be executed by any User.

Syntax of the System Function xa_gtrid()

    xa_gtrid(xid, int)
    

The parameters of the System Function xa_gtrid()

"xid"
The parameter "xid" is the identification number (id) of a ASE transaction. The "xid" can be retrieved from the column "xactname" of the system table systransactions or using the stored procedure sp_transactions. xa_gtrid does not validate the transaction id; it just returns an unformated string.

"int"
The parameter "int" specifies an integer value. This is currently set to "0" by default and reserved for future use.

Example for the System Function xa_gtrid()

    select xa_gtrid("0000000B_FfgIT345iG7bF1#AGffzaM_8DZ61E1", 0)
go

--------------------------------------------------------------------------
0xb1857bdv23456a61cba42fe34256df542

The return value is the global transaction id in binary format of the ASE transaction id "0000000B_FfgIT345iG7bF1#AGffzaM_8DZ61E1".

See also:
col_length(),
col_name(),
curunreservedpgs(),
data_pages(),
data_pgs(),
datachange(),
datalength(),
db_id(),
db_name(),
derived_stat(),
host_id(),
host_name(),
identity_burn_max(),
index_col(),
index_colorder(),
is_quiesced(),
isnull(),
datachange(),
license_enable(),
lockscheme(),
next_identity(),
object_id(),
object_name(),
pageinfo(),
pagesize(),
partition_id(),
partition_name(),
partition_object_id(),
pointer_size(),
pnt_data_pgs(),
pssinfo(),
reserved_pages(),
reserved_pgs(),
row_count(),
rowcnt(),
showplan_in_xml(),
syb_quit(),
syb_sendmsg(),
tempdb_id(),
tran_dumptable_status(),
tsequal(),
used_pages(),
used_pgs() xa_bqual() and
Functions.

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
data_pgs(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
isnull(),
lct_admin(),
license_enabled(),
lockscheme(),
next_identity(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().