From 0eed8a78b6976918432619700f7db4b7620c99b8 Mon Sep 17 00:00:00 2001 From: dbrownems Date: Wed, 13 Jul 2022 10:43:48 -0500 Subject: [PATCH] Updating template to drop trusted assembly only if it exists, preventing error. --- samples/features/sql-clr/Curl/SqlClrCurl.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/features/sql-clr/Curl/SqlClrCurl.tt b/samples/features/sql-clr/Curl/SqlClrCurl.tt index 3dd3b704..94166667 100644 --- a/samples/features/sql-clr/Curl/SqlClrCurl.tt +++ b/samples/features/sql-clr/Curl/SqlClrCurl.tt @@ -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)