SQL Server – Odd behaviour with cached temp tables, a linked server and MSDTC (failing)

I recently encountered some strange behaviour occurring in a production system, whereby a procedure called from an application failed due to the error “unable to enlist in a distributed transaction”.  However, running the procedure from SSMS worked fine, and led to the procedure working again without problem from the application.


Continue reading


SQL Server – THROW and Output variables: Output variables are not returned when an error occurs

With SQL Server 2012, the THROW statement was introduced to T-SQL.  On the whole, I find the syntax and usability of THROW to be more intuitive than RAISERROR, however I came across an interesting difference today: the way in which they handle output variables from a stored procedure.

Continue reading