Skip to content

Commit 0eed8a7

Browse files
committed
Updating template to drop trusted assembly only if it exists, preventing error.
1 parent 1fabdbd commit 0eed8a7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

samples/features/sql-clr/Curl/SqlClrCurl.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ SELECT @hash = hash
2424
FROM sys.trusted_assemblies ta
2525
WHERE ta.description = N'SqlClrCurl'
2626

27-
EXEC sp_drop_trusted_assembly @hash;
27+
if (@hash is not null)
28+
EXEC sp_drop_trusted_assembly @hash;
2829
GO
2930

3031
--Drop the assembly if it already exists
3132
DROP ASSEMBLY IF EXISTS SqlClrCurl;
3233
GO
3334

34-
3535
DECLARE @assembly VARBINARY(MAX) = <#= "0x" + BitConverter.ToString(System.IO.File.ReadAllBytes(this.Host.ResolvePath("bin\\Release\\SqlClrCurl.dll"))).Replace("-","") #>
3636
DECLARE @hash VARBINARY(64);
3737
SELECT @hash = HASHBYTES('SHA2_512', @assembly)

0 commit comments

Comments
 (0)