From 378b64b6db2e110205dd6d7e052a98b050737733 Mon Sep 17 00:00:00 2001 From: Pavel Mamut Date: Thu, 5 Feb 2026 20:23:58 -0500 Subject: [PATCH] account for non-asset `WebhookReceipt` blobs and ignore NULL value original script predates `WebhookReceipt` non-asset table with optional `Blob` reference fields, for which `AssetType` & AttributeDefinition` metadata doesn't exist, as well as optional `ExternalActionInvocation.Received` blob attribute --- purge-project/PurgeUnusedBlobs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/purge-project/PurgeUnusedBlobs.sql b/purge-project/PurgeUnusedBlobs.sql index 1e1d565..4c1d74e 100644 --- a/purge-project/PurgeUnusedBlobs.sql +++ b/purge-project/PurgeUnusedBlobs.sql @@ -10,11 +10,11 @@ set nocount on create table #inuse (ID int not null primary key) declare @sql varchar(8000); select @sql='insert #inuse(ID)' -select @sql = @sql + ' select ' + QUOTENAME(d.Name) + ' from dbo.' + QUOTENAME(t.Name) + ' union' +select @sql = @sql + ' select ' + QUOTENAME(d.Name) + ' from dbo.' + QUOTENAME(t.Name) + ' where ' + QUOTENAME(d.Name) + ' is not null union' from AttributeDefinition_Now d join AssetType_Now t on t.ID=d.AssetID where d.AttributeType='Blob' -select @sql = left(@sql, len(@sql) - len(' union')) +select @sql = @sql + ' select HeadersId from dbo.WebhookReceipt where HeadersId is not null union select ResponseId from dbo.WebhookReceipt where ResponseId is not null' --print @sql exec (@sql)