Skip to content

Instantly share code, notes, and snippets.

@Hendy
Hendy / DeleteAllVersions.sql
Last active October 28, 2020 10:10
Umbraco - delete version history for all content
-- Create a temporary table for all documents which are published and not in the recycle bin
CREATE TABLE #Nodes (id int)
-- Delete all rows if the table exists before
TRUNCATE TABLE #Nodes
-- Insert all nodeIds from all documents which are published and not in the recycle bin
INSERT INTO #Nodes
SELECT N.id
FROM umbracoNode N
INNER JOIN cmsDocument D ON N.ID = D.NodeId