Bug #12866 No accessible transaction id within triggers
Submitted: 30 Aug 2005 5:11 Modified: 14 Oct 11:09
Reporter: Frank McGeough
Status: Verified
Category:Server: General Severity:S4 (Feature request)
Version:5.0.11 OS:Microsoft Windows (Windows 2003 server)
Assigned to: Target Version:
Triage: Needs Triage: D5 (Feature request)

[30 Aug 2005 5:11] Frank McGeough
Description:
There is nothing in the trigger documentation or in the standard procedures that
specifies how to uniquely identify a transaction. What is needed is a transaction id.
This is available on Microsoft SQL Server, Oracle, and Sybase SQL Anywhere (its not
available on db2 as far as I know). One use case is if I wish to log information about
operations within a transaction to a reporting table.  I can not do so currently because
I have no identifier with which to group the operations within a transaction. 

How to repeat:
Missing feature.

Suggested fix:
A guid generated internally by the engine at the start of a transaction and used to
identify a transaction would be ideal. The trigger should be able to call
TRANSACTION_ID() just like we can now call CONNECTION_ID(). It should probably return a
string to give the most flexibility to the implementation. It just needs to be unique
which is why a guid meets the criteria.
[3 Sep 2005 2:09] RW Shore
I need this as well.
[2 Feb 11:19] Jaka JanĨar
+1, if it means anything.
[14 Oct 11:09] Valeriy Kravchuk
Thank you for the feature request.