I've created a stored procedure using SQL CLR c# stored procedure
in Visual Studio 2017 and I've published it in MSSQL Server
. Now I can see my stored procedure, but I face this error when I want to execute the procedure.
The error is:
Msg 6522, Level 16, State 1, Procedure cust_diff, Line 0 [Batch Start Line 2] A .NET Framework error occurred during execution of user-defined routine or aggregate "cust_diff":
System.Security.SecurityException:
System.Security.Permissions.SecurityPermission System.Security.SecurityException: at LevenshteinDistance.cust_diff()
I've added these two at the beginning of my code in C#
using System.Security;
using System.Security.Permissions;
and also this is part of my code that I use to create the procedure:
[Microsoft.SqlServer.Server.SqlProcedure]
[PermissionSet(SecurityAction.Assert, Unrestricted = true)]
public static void cust_diff()
{
// Put your code here
LevenshteinDistance ld = new LevenshteinDistance();
ld.Method1();
}
but despite using these two, I cannot execute my procedure in SSMS.