You execute a common language runtime (CLR) stored procedure or a CLR function in the SQL Server process. In the CLR stored procedure or the CLR function, you use a context connection to open a loop-back connection and execute many Transact-SQL statements. For example, you execute 1 billion Transact-SQL statements. Additionally, these Transact-SQL statements do not return result sets. For example, these Transact-SQL statements are SET statements or cursor operations.
When you run the CLR stored procedure or the CLR function in SQL Server 2005, you may receive one of the following error messages:
Error Message 1
Server: Msg 6535, Level 16, State 49
.NET Framework execution was aborted. Another query caused the AppDomain AppDomain.1 to be unloaded or an unhandled .NET exception happened.
Note AppDomain represents the name of the application domain in which the code runs.
Error Message 2
Server: Msg 6532, Level 16, State 70
.NET Framework execution was aborted by escalation policy because of out of memory.
When this problem occurs, messages that resemble the following are logged in the SQL Server Errorlog:
2007-01-15 14:47:46.76 spid51 AppDomain 3 (CLR_DB.dbo[runtime].2) created.
2007-01-15 14:49:48.06 spid1s AppDomain 3 (CLR_DB.dbo[runtime].2) is marked for unload due to memory pressure.
2007-01-15 14:51:23.47 spid51 Error: 6532, Severity: 16, State: 70.
2007-01-15 14:51:23.47 spid51 .NET Framework execution was aborted by escalation policy because of out of memory.
2007-01-15 14:51:53.31 spid51 AppDomain 3 (CLR_DB.dbo[runtime].2) unloaded.