Publish content exactly 24 hours after it was created
I am using sql server database.it has fields Isactive and created date...say created date=09/11/2010 5.00pm and its intial status=false by 10/11/2010 5.00pm it Isactive 开发者_高级运维should be true. How to acheive this
Ideally I think you could base the "is record active" info on a date field instead of a bool field e.g.
-- records that are active 24 hours after their created_date
SELECT AField
FROM SomeTable
WHERE created_date < DATEADD(dd, GETDATE(), -1)
Otherwise, you'll need to have a scheduled job to go through to update the bool flag for all rows that are now active - could need to be run very often if time is given down to full level of accuracy (hh:mm:ss.....) and you need it to become active pretty much straight away.
精彩评论