Symptoms
When you run Microsoft SQL Server 2005 or Microsoft SQL Server 2000 on a Windows Server 2003-based computer or on a Windows 2000-based computer, you may receive an error message that contains the following error messages:

Failed to load FileName.dll

Attempts to load any type of dll might fail within the SQL Server process with errors pointing to LoadLibrary failure.This problem usually occurs after SQL Server has been running for some time.
The complete error message that you receive resembles the following:

Exception Type: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: The read on the database failed. Reason: Failed to load Msxmlsql.dll.
Data: System.Collections.ListDictionaryI,4092,NULL,NULL,2007-04-13 09:44:11.640,DB\SQLServer5,warning,2007-04-13 09:44:13.153,
The activated proc [dbo].[sp_sysmail_activate] running on queue msdb.dbo.ExternalMailQueue output the following:’The service queue “ExternalMailQueue” is currently disabled.’
Attempts to use XML related activity in TSQL fails.
Msg 6610, Level 16, State 1, Procedure sp_xml_preparedocument, Line 1
Failed to load Msxmlsql.dll.
Msg 6607, Level 16, State 3, Procedure
sp_xml_removedocument, Line 1sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
Attempts to load any type of dll might fail within the SQL Server process with errors pointing to LoadLibrary failure.
Attempts to use extended stored procedures will result in
Msg 0, Level 16, State 0, Procedure xp_ss_backup, Line 1
Cannot load the DLL C:\Program Files\Microsoft SQL Server\MSSQL\Binn\SQLsafe_ExtendedStoredProc.dll, or one of the DLLs it references. Reason: 1114(A dynamic link library (DLL) initialization routine failed.).
Error: 18210, Severity: 16, State: 1.
BackupVirtualDeviceSet::Initialize: CoCreateInstance failure on backup device ‘d4630f27-03a1-47ae-b7a7-4813a6809908′. Operating system error 0×8007045a(A dynamic link library (DLL) initialization routine failed.).
Resolution
This problem occurs because no thread local storage (TLS) slot is available for the SQL Server process (Sqlservr.exe). This is a problem in Windows Server 2003 and in Windows 2000.
When SQL Server unloads a DLL, the TLS slots that the DLL uses may not be released because of a problem in the TlsFree function. If SQL Server frequently loads various DLLs, and then unloads these DLLs, these DLLs use up all the available TLS slots. Eventually, SQL Server can no longer load a DLL that requires TLS slots.