sql 按Umbraco中的文档类型删除所有节点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 按Umbraco中的文档类型删除所有节点相关的知识,希望对你有一定的参考价值。

BEGIN TRAN
 
DECLARE @Nodes TABLE (NodeId int)
 
INSERT INTO @Nodes (NodeId)
SELECT top 1000 n.id
FROM cmsContent C 
	INNER JOIN cmsContentType CT ON C.contentType = CT.nodeId 
	INNER JOIN umbracoNode N ON C.nodeId = N.id
WHERE CT.alias = '[Your Document Type Alias Here]'
 
select id, [text] from umbracoNode where id in (select NodeId from @Nodes)
 
delete from cmsPreviewXml where nodeId in (select NodeId from @Nodes)
delete from cmsContentVersion where contentId in (select NodeId from @Nodes)
delete from cmsDocument where nodeId in (select NodeId from @Nodes)
delete from cmsContentXML where nodeId in (select NodeId from @Nodes)
delete from cmsContent where nodeId in (select NodeId from @Nodes)
delete from cmsPropertyData where contentNodeId in (select NodeId from @Nodes)
delete from umbracoRelation where parentId in (select NodeId from @Nodes) OR childId in (select NodeId from @Nodes)
delete from cmsTagRelationship where nodeId in (select NodeId from @Nodes)
delete from umbracoNode where id in (select NodeId from @Nodes)
 
DELETE FROM @Nodes

--COMMIT TRAN 

ROLLBACK TRAN

以上是关于sql 按Umbraco中的文档类型删除所有节点的主要内容,如果未能解决你的问题,请参考以下文章

sql Umbraco - 删除所有内容的版本历史记录

sql 删除Umbraco中的旧版本

sql 删除Umbraco中的旧版本

sql Umbraco部门包 - 将相同的部门节点权限复制到另一个部门。 #umbraco #sql

sql 检索具有挂起更改的Umbraco文档列表

sql 检索具有挂起更改的Umbraco文档列表