Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nathan 67 posts 146 karma points
    Sep 24, 2020 @ 11:17
    Nathan
    0

    Delete property content of all children of given node via SQL query

    Hi,

    Given a node with ID "X", how can we delete the values/content of a property with alias "Y" of all the children (and their children) pages of node "X", via an SQL Server query?

    So that only the content of the properties will be empty, not deleting the property itself, just their values.

    The property we need to empty is a nested content type, all its items need to be removed.

    Thanks!

  • Joep 96 posts 698 karma points
    Sep 28, 2020 @ 10:14
    Joep
    0

    Hey,

    You can use something like this:

    update upd
    set  varcharValue = null, textValue = null
    from umbracoPropertyData upd
    join umbracoContentVersion cv on cv.id = upd.versionId
    join umbracoNode un on un.id = cv.nodeId
    join cmsPropertyType pt on pt.id = upd.propertyTypeId
    where un.nodeObjectType like 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' and Alias like 'title' and  (cv.nodeId = 1053 or un.[path]  like '%1053,%')
    

    Just replace the 'title' with Y, and replace the 1053 with the X

    -Joep

Please Sign in or register to post replies

Write your reply to:

Draft