Hi all,
I have umbraco 8.1.5 website and I want to delete a folder which contains another subfolders from Media Recycle bin. My structure is:
When I right click on Patient Images and click delete I got the following error:
The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "FK_umbracoNode_umbracoNode_id". The conflict occurred in database "VMDent_Live", table "dbo.umbracoNode", column 'parentId'. The statement has been terminated.
I understand why I am getting the error - "Patent Images" is parent of the subnodes, but I have a lot of subnodes and deleting them manually is not an option.
Is there a way to delete the parent folder with all of its subnodes.
-- This will identify orphan nodes and delete those notes.
DELETE FROM dbo.cmsPropertyData WHERE contentNodeId IN (
select items.id from umbracoNode as items
left join umbracoNode as parent on items.parentID = parent.id
WHERE parent.id is NULL
);
DELETE FROM dbo.cmsPreviewXml WHERE nodeId IN (
select items.id from umbracoNode as items
left join umbracoNode as parent on items.parentID = parent.id
WHERE parent.id is NULL
);
DELETE FROM dbo.cmsContentVersion WHERE ContentId IN (
select items.id from umbracoNode as items
left join umbracoNode as parent on items.parentID = parent.id
WHERE parent.id is NULL
);
DELETE FROM dbo.cmsDocument WHERE nodeId IN (
select items.id from umbracoNode as items
left join umbracoNode as parent on items.parentID = parent.id
WHERE parent.id is NULL
);
DELETE FROM dbo.cmsContent WHERE nodeId IN (
select items.id from umbracoNode as items
left join umbracoNode as parent on items.parentID = parent.id
WHERE parent.id is NULL
);
ALTER TABLE umbracoNode NOCHECK CONSTRAINT FKumbracoNodeumbracoNodeid;
DELETE FROM umbracoNode WHERE id in (
select items.id from umbracoNode as items
left join umbracoNode as parent on items.parentID = parent.id
WHERE parent.id is NULL
);
ALTER TABLE umbracoNode CHECK CONSTRAINT FKumbracoNodeumbracoNodeid;
You can also manually delete problemetic nodes using below SQL code.
DELETE FROM dbo.cmsPropertyData WHERE contentNodeId IN (67898);
DELETE FROM dbo.cmsContentVersion WHERE ContentId IN (67898);
DELETE FROM dbo.cmsPreviewXml WHERE nodeId IN (67898);
DELETE FROM dbo.cmsDocument WHERE nodeId IN (67898);
DELETE FROM dbo.cmsMember2MemberGroup WHERE Member IN (67898);
DELETE FROM dbo.cmsMember WHERE nodeId IN (67898);
DELETE FROM dbo.cmsContentXml WHERE nodeId IN (67898);
DELETE FROM dbo.cmsContent WHERE nodeId IN (67898);
ALTER TABLE umbracoNode NOCHECK CONSTRAINT FK_umbracoNode_umbracoNode_id;
DELETE FROM umbracoNode WHERE id in (67898);
ALTER TABLE umbracoNode CHECK CONSTRAINT FK_umbracoNode_umbracoNode_id;
Empty Media Recycle Bin
Hi all, I have umbraco 8.1.5 website and I want to delete a folder which contains another subfolders from Media Recycle bin. My structure is:
When I right click on Patient Images and click delete I got the following error:
I understand why I am getting the error - "Patent Images" is parent of the subnodes, but I have a lot of subnodes and deleting them manually is not an option. Is there a way to delete the parent folder with all of its subnodes.
-- This will identify orphan nodes and delete those notes.
DELETE FROM dbo.cmsPropertyData WHERE contentNodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );
DELETE FROM dbo.cmsPreviewXml WHERE nodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );
DELETE FROM dbo.cmsContentVersion WHERE ContentId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );
DELETE FROM dbo.cmsDocument WHERE nodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );
DELETE FROM dbo.cmsContent WHERE nodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );
ALTER TABLE umbracoNode NOCHECK CONSTRAINT FKumbracoNodeumbracoNodeid; DELETE FROM umbracoNode WHERE id in ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL ); ALTER TABLE umbracoNode CHECK CONSTRAINT FKumbracoNodeumbracoNodeid;
You can also manually delete problemetic nodes using below SQL code.
is working on a reply...