首页 > 解决方案 > 编译 SQLCLR 函数期间出现 NullReferenceException

问题描述

我在 sql 2016 实例上的 5 个不同数据库上运行下面的 sql server 函数:

select * FROM fn_myfunction('', 0, 0,'30 Apr 2015','1', 0)

并收到此错误消息:

Msg 10313, Level 16, State 51, Line 1
An error occurred while using the .NET Framework during IL compilation. The server may be running out of resources. Try running the query again. If the problem persist, contact a support professional. 
System.NullReferenceException: Object reference not set to an instance of an object.
System.NullReferenceException: 

我已经对这些数据库进行了备份并恢复到不同的 sql 2016 实例,错误消失了。所以我现在认为这与我的数据库或sql代码无关。这可能是环境问题?

请问有什么建议吗?

标签: sqlsql-serversqlclr

解决方案


我已经重新启动了我的实例并且这有效。这里的问题与@Panagiotis 建议的数据库或代码无关,因为我在不同的实例上使用了相同的数据库并且无法重现错误。这取决于充分利用内存。所以我改变了我的内存设置并重新启动了实例并像锤子一样工作!!!!!!!!!!!!!!!


推荐阅读