sp_configure 'show advanced options', 1 RECONFIGURE GO sp_configure 'clr_enabled', 1 RECONFIGURE GO sp_configure GO
USE TrustedAsmDB; GO CREATE ASSEMBLY Sql2k17TrustedAsm FROM 'W:\\<path_to_dll>\\Sql2k17TrustedAsm1.dll' GO
创建程序集后导出为脚本,获取到里面的二进制值
USE master; GO DECLARE @clrName nvarchar(4000) = 'sql2k17trustedasm1, ...' DECLARE @asmBin varbinary(max) = 0x4D5A90000300000004000000FFFF00...; DECLARE @hash varbinary(64); SELECT @hash = HASHBYTES('SHA2_512', @asmBin); EXEC sys.sp_add_trusted_assembly @hash = @hash, @description = @clrName;