On Tue, Dec 13, 2011 at 6:13 PM, Brook Davies <cft...@logiforms.com> wrote:

> I guess my question is, will this lead to performance problems? Is there a
> more elegant way to do this?
>

Are you using MS SQL server? If so you only need one query which will still
output rows like the first query with OUTPUT.

  <cfquery name="getEvents">
   update t1
   set t1.enabled = 0
   OUTPUT inserted.ID, inserted.cfc, inserted.runMethod,
inserted.arguments, inserted.frequency, inserted.frequencytype
   from scheduledTasks t1
   inner join scheduledTasks t2
       on t1.ID = t2.ID
    where t2.enabled = 1
      and t2.nextDate < <cfqueryparam cfsqltype="cf_sql_timestamp"
value="#createodbcdatetime(Now())#">
      and t2.startDate < <cfqueryparam cfsqltype="cf_sql_timestamp"
value="#createodbcdatetime(Now())#">
      and t2.endDate > <cfqueryparam cfsqltype="cf_sql_timestamp"
value="#createodbcdatetime(Now())#">
  </cfquery>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349091
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to