Updating template to drop trusted assembly only if it exists, preventing error.

This commit is contained in:
dbrownems
2022-07-13 10:43:48 -05:00
parent 1fabdbdced
commit 0eed8a78b6
+2 -2
View File
@@ -24,14 +24,14 @@ SELECT @hash = hash
FROM sys.trusted_assemblies ta
WHERE ta.description = N'SqlClrCurl'
EXEC sp_drop_trusted_assembly @hash;
if (@hash is not null)
EXEC sp_drop_trusted_assembly @hash;
GO
--Drop the assembly if it already exists
DROP ASSEMBLY IF EXISTS SqlClrCurl;
GO
DECLARE @assembly VARBINARY(MAX) = <#= "0x" + BitConverter.ToString(System.IO.File.ReadAllBytes(this.Host.ResolvePath("bin\\Release\\SqlClrCurl.dll"))).Replace("-","") #>
DECLARE @hash VARBINARY(64);
SELECT @hash = HASHBYTES('SHA2_512', @assembly)