Is there a simple way to detect if a transaction for a given name is open? For example in this code, I need to know whether to rollback the transaction in the error handler.
BEGIN TRY
... do stuff
BEGIN TRANSACTION MyTransaction
...do stuff
COMMIT TRANSACTION MyTransaction
...do more stuff
END TRY
BEGIN CATCH
IF (**Is MyTransaction still open?**) ROLLBACK MyTransaction
END CATCH