I wrote a custom function that takes the value of UtcTimeStamp and windowstimezoneid as parameters and returns a TimeStamp for TimeZone.
But if I want to execute it with a simple parting, I get the following error:
A .NET Framework error occurred during execution of user-defined routine or aggregate "ToLocalTime": System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host. The protected resources (only available with full trust) were: All The demanded resources were: MayLeakOnAbort System.Security.HostProtectionException: bei TimeFunctions.ToLocalTime(DateTime UtcTimestamp, String WindowsTimeZoneId)
I execute select as sa. I set clr enabled to 1. I am using SQL Server 2008 R2 (10.50.1600).
Does anyone know what I need to configure in order to make this work or what can I do wrong?
source share