Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.
Msg 10314, Level 16, State 11, Line 1
An error occurred
ALTER AUTHORIZATION ON DATABASE::mydb TO sa;
ALTER DATABASE [myDB] SET TRUSTWORTHY ON
GO
Build your project with ANY CPU configuration. I had this problem when compiled my own project with x86 configuration and tried to run it on x64 SQL server.
Applied all of the above suggestion and it failed. Then I recompiled my source code with "Any CPU" option, and it worked!
This link helped: SQL Server failed to load assembly with PERMISSION
Does your assembly do file I/O? If so, you must grant the assembly permission to do this. In SSMS:
Ran the SQL commands below and the issue appears to be resolved.
USE database_name
GO
EXEC sp_changedbowner 'sa'
ALTER DATABASE database_name SET TRUSTWORTHY ON