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..
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..
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..
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
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..
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..
is working on a reply...