Skip to content

Instantly share code, notes, and snippets.

@danielrolfe
Created September 17, 2020 21:42
Show Gist options
  • Save danielrolfe/4c594513a0ce4c41af93c9980fa07faf to your computer and use it in GitHub Desktop.
Save danielrolfe/4c594513a0ce4c41af93c9980fa07faf to your computer and use it in GitHub Desktop.
Simple SQL script to delete the recycle bin rows from the Sitecore Archive tables. Use it at your own risk!
declare @CleanupList table(ArchivalId uniqueidentifier)
declare @ArchivalId uniqueidentifier
insert into @CleanupList(ArchivalId)
select ArchivalId
from dbo.Archive
where ArchiveName = 'recyclebin'
while(1 = 1)
begin
set @ArchivalId = NULL
select top (1) @ArchivalId = ArchivalId
from @CleanupList
if @ArchivalId IS NULL
break
delete from dbo.ArchivedFields where ArchivalId = @ArchivalId
delete from dbo.ArchivedItems where ArchivalId = @ArchivalId
delete from dbo.ArchivedVersions where ArchivalId = @ArchivalId
delete from dbo.Archive where ArchivalId = @ArchivalId
delete top(1) from @CleanupList
end
@sansani4
Copy link

Thank you so much!!! I see it!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment