How to delete node through database

cancel
Showing results for 
Search instead for 
Did you mean: 
miroslav
Customer

How to delete node through database

Hi, 

I would like to delete specific node throught metadata database (alf_node.id) because of inconsistencies. Pls, does anyone have experience with it? I looking for SQL command. 

Thank you!

1 Reply
arjunmony
Established Member

Re: How to delete node through database

Hello,

If you knew the content url, try the below sql query,

SELECT
n.id as node_id,
aq.local_name as node_type,
npn.string_value as node_name,
ca.parent_node_id,
cu.content_size,
cu.content_url,
n.uuid,
n.audit_created
FROM alf_node as n
left outer join alf_node_properties npn on
(npn.node_id=n.id and npn.actual_type_n=6 and npn.qname_id in
(select id from alf_qname where local_name='name'))
left outer join alf_node_properties npc on
(npc.node_id=n.id and npc.actual_type_n=21 and npc.qname_id in
(select id from alf_qname where local_name='content'))
left outer join alf_content_data cd on (cd.id = npc.long_value)
left outer join alf_content_url cu on (cd.content_url_id = cu.id)
left outer join alf_child_assoc ca on (ca.child_node_id=n.id)
left outer join alf_qname aq on (n.type_qname_id=aq.id)
where
aq.local_name in ('folder','content')
and cu.content_url like '%{content_url}%'