Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions purge-project/PurgeUnusedBlobs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we discover these by foreign key?


--print @sql
exec (@sql)
Expand Down