In Sybase server-side language how can my code test whether it's running in chained or unchained (auto-commit) mode?

Examining the status of @@TRANCOUNT is not really conclusive.

I gather that there must be a way as for instance, JDBC provides getAutoCommit which is able to detect whether the connection is in auto-commit (unchained) mode or not. But how do I do that from within a stored procedure?

I've found this question but it seems to answer for SQL Server only.


Sybase ASE's default mode is unchained, as I suspect you already know.

You can use SELECT @@tranchained; to see the status for the current session's transaction chaining mode.

The result is either 0 or 1, per the following:

0 = unchained
1 = chained

Transaction chaining mode can be modified with SET CHAINED ON; or SET CHAINED OFF;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.