Monday 3 December 2012

Weird cause of Msg 3989 / "New request is not allowed to start because it should come with valid transaction descriptor"

Running a query against SQL Server 2008 R2 using SQL Server Management Studio (or wot I sometimes and apparently-mistakenly call Enterprise Manager), I got back the error...

Msg 3989, Level 16, State 1, Line 1

New request is not allowed to start because it should come with valid transaction descriptor



This was a slightly tricky query I'd been building up and it used a table-value function (i.e. a user-defined function that returns a table type) which ran against a Linked Server's tables, joining that to local tables.

A quick google gave many hits about ADO.Net pooling and suggestions to upgrade things to latest service-packs.  In my case though this wasn't the problem.

All I needed to do was fix the table-value function, which was throwing a datatype-conversion error.  (I'd made a quick amendment and hadn't tested it outside the bigger query.)