Follow the steps:
1. Place the DLL on SQL server at specific location e.g:
C:\CRLProject\Database1.XmlSerializers.dll
2. Execute below SQL query to install the assembly
EXISTS (SELECT [name] FROM sys.assemblies WHERE [name] = N'MySqlCLRProject')
BEGIN
DROP ASSEMBLY MySQLCLRProject
ALTER ASSEMBLY MySQLCLRProject
FROM 'C:\CRLProject\Database1.XmlSerializers.dll'
WITH PERMISSION_SET = UNSAFE ;
END
ELSE
BEGIN
CREATE ASSEMBLY MySQLCLRProject
FROM 'C:\CRLProject\Database1.XmlSerializers.dll'
WITH PERMISSION_SET = UNSAFE;
END
3. Use stored procedure as mentioned below
T ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[dsp_SampleCLRSP]
@dataList [nvarchar](max)
WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [MySQLCLRProject].[StoredProcedures].[dsp_CLRGetSampleList]
GO
4. Execute below database command
ALTER DATABASE Database1 SET TRUSTWORTHY ON
5. Execute below command
CLARE @Command VARCHAR(MAX) = 'ALTER AUTHORIZATION ON DATABASE::Database1 TO [<big>somedvuser</big>]'
SELECT @Command = REPLACE(REPLACE(@Command
, 'Database1', SD.Name)
, 'DomainName\<big>yoursqluserid</big>', SL.Name)
FROM master..sysdatabases SD
JOIN master..syslogins SL ON SD.SID = SL.SID
WHERE SD.Name = DB_NAME()
PRINT @Command
EXEC(@Command)
Please let us know if you still facing the issue.