I am running a sql server function below on 5 different databases on sql 2016 instance:
select * FROM fn_myfunction('', 0, 0,'30 Apr 2015','1', 0)
And am getting this error message:
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:
I have made a backup of these databases and restored to a different sql 2016 instance and the error disappeared. So I now think that this has nothing to do with my databases or sql code. This could be an environment issue?
Any suggestions please?