Don’t call into the CLR from SQL Server
From time to time I’ve considered making a call from a SQL Server stored proc into a .NET assembly via COM Interop using the sp_OA stored procedures as a mechanism to perform some database triggered activity (say from a scheduled job). I’ve always found a different solution in the end and it turns out to have been lucky that I did so:
To increase performance, the CLR internally uses thread-local-storage (TLS) which isn’t allowed inside the SQL Server memory space. In addition, SQL may be configured to use fibers, which the CLR additionally doesn’t support.