Consider the following scenario:
- There is an SQLCLR function that's declared as "deterministic", and the function can be used for the "replacement with a constant" optimization.
- There is a synonym that points to the SQLCLR function.
- A table-valued function (TVF) references to the SQLCLR function through the synonym.
In this scenario, when an application queries this TVF, an access violation may occur, and you may receive an error message that resembles the following:
Message 0, Level 11, State 0, Row 14
A severe error occurred on the current command. The results, if any, should be discarded.
Additionally, an error message is logged in the SQL Server error log.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.