This SQL will query the database and delete any Scheduled Macro Activities that are no longer associated with a Recurring Activity.
High. Data is modified and removed in this query. Do not run this except under the direction of a Cyrious Technical Support staff member. Doing otherwise may result in lost or contaminated data. All data modifications done through direct SQL are permanent and non-reversable.
Query to select a list of all scheduled activities and macro activity template. This query allows you to review the data prior to running the delete query.
SELECT
J.ID as JournalID
, J.ClassTypeID – 21200 macro activity ; 20610 = macro activity template
, J.EmployeeID
, J.JournalActivityType – 16 = Macro Activity ; 42 = Macro Activity Template
, J.JournalActivityText
, J.Description
, J.RecurringActivityID
, J.RecurringClassTypeID
FROM Journal J WITH(NOLOCK)
WHERE J.ClassTypeID IN (21200,21250) AND CompletedDateTime IS NULL
;
Query to delete all Scheduled Activities and Macro Activity Templates that are no longer associated with a valid Recurring Activity.
– DELETE FROM Journal – Remove the – at the beginning of this statement before executing.
WHERE ClassTypeID IN (21200,21250)
AND RecurringActivityID NOT IN (SELECT ID FROM RecurringActivity)
AND CompletedDateTime IS NULL
;
– delete from RuleActivity – Remove the – at the beginning of this statement before executing.
where ID not in (Select ID from Journal)