This script is used to create a generated DLL and serialize the DLL to the database. [Record, backup view]
Sp_configure ' CLR Enabled ' , 1
Go
Reconfigure
Go
Alter DatabaseDatabase_nameSetTrustworthyOn
Go
UseDatabase_name
Go
If Exists ( Select * From SYS. Objects Where Object_id = Object_id (N ' [DBO]. [test] ' ) And Type In (N ' P ' , N ' PC ' ))
Drop Procedure [ DBO ] . [ Test ]
Go
If Exists ( Select [ Name ] From SYS. Assemblies Where [ Name ] = N ' Test. xmlserializers ' )
Drop Assembly [ Test. xmlserializers ]
Go
If Exists ( Select [ Name ] From SYS. Assemblies Where [ Name ] = N ' Test ' )
Drop Assembly [ Test ]
Go
CreateAssembly Test
From 'E: \ path \ test. dll'
WithPermission_set=Unsafe
Go
//Serialize the dll path
CreateAssembly[Test. xmlserializers]
From 'E: \ path \ test. xmlserializers. dll'
WithPermission_set=Safe
Go
Create Procedure Test
(
@ No_comp Nvarchar ( 10 ),
@ Begdate Nvarchar ( 10 ),
@ Enddate Nvarchar ( 10 )
)
As
External name test. storedprocedures. Test
go