Last active
May 1, 2019 21:36
-
-
Save adnanzameer/f4305a18641b9652aeed907079f6cecd to your computer and use it in GitHub Desktop.
SQL script to delete unpublished single version content from Episerver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @pkid int | |
DECLARE db_cursor CURSOR FOR select distinct fkPageID from tblWorkpage where HasBeenPublished= 0 Group by fkpageid having count(fkPageID) = 1 | |
declare @isLeafNode int | |
OPEN db_cursor | |
FETCH NEXT FROM db_cursor INTO @pkid | |
WHILE @@FETCH_STATUS = 0 | |
BEGIN | |
select @isLeafNode = IsLeafNode from tblContent where pkID=@pkid | |
if(@isLeafNode = 1) | |
Begin | |
EXEC [dbo].editDeletePage @PageID = @pkid, @ForceDelete = 1 | |
End | |
FETCH NEXT FROM db_cursor INTO @pkid | |
END | |
CLOSE db_cursor | |
DEALLOCATE db_cursor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment