Copied to clipboard

Flag this post as spam?

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


  • Ansar 181 posts 291 karma points
    Oct 14, 2011 @ 21:19
    Ansar
    0

    Getting release and expire dates directly from DB - Please confirm the query is right or not

    My website is a bit huge and looping through all the nodes using Umbraco APIs to get release and expire dates is timing out.. so I wrote the following query to find the expire and relese dates of published nodes..

    SELECT D.nodeId, D.releaseDate, D.expireDate FROM dbo.cmsDocument D
                    WHERE D.newest = 1 AND
                    (
                        ( D.releaseDate IS NOT NULL AND D.releaseDate <= GETDATE() )
                        OR
                        ( D.expireDate IS NOT NULL AND D.expireDate <= GETDATE() )
                    );

    can any one please confirm whether its right or wrong... If its wrong, what is the proper way to get these values..

    Thanks,
    Anz

     

  • julius 107 posts 289 karma points
    Oct 16, 2011 @ 23:24
    julius
    0

    I am missing the published flag in the WHERE clause. And why are you only searching for release and expiry dates that are in the past? Is that intentional? They can both be in the future..

  • Ansar 181 posts 291 karma points
    Oct 18, 2011 @ 14:46
    Ansar
    0

    my intentaion is to get nodes missed the scheduled publishes (in old version Umbraco that can happen) and forecfully publish it by periodically using a windows service..  so I need to SELECT both published and unpublished nodes which has an old schedule dates set..

Please Sign in or register to post replies

Write your reply to:

Draft