From TechNet Library
After a deadlock is detected, the Database Engine completes by selecting one of the threads as a victim of a deadlock. The database engine completes the current batch being run for the thread, rollback the deadlock victim transaction, and returns error 1205 for the application. Rolling back a transaction for a deadlock victim releases all locks held by the transaction. This allows transactions of other threads to unlock and continue. Error 1205 deadlock victim writes thread information and resources involved in a deadlock in the error log.
So, your transaction is safe to rollback, and you can try it again.
EDIT
Being lazy **, I have not fully studied your question. Let's see:
Is it possible to do something similar for command and / or connection timeouts?
I would not do the same generalization because you could try to read data from a database that is not accessible at all. You must have the maximum number of attempts.
I mean, itβs not possible to work on SQL Server, only for a timeout before the data returns to the caller, right?
Never heard of this, and it should not be possible if you use transactions . And you should use them with XACT_ABORT, the flag Specifies whether SQL Server automatically rolls back the current transaction when a Transact-SQL statement raises a run-time error. However, for work it is impossible to complete, not incomplete, see the zombie transaction .
I also found this .
source share