This SQL will query the database and delete any Scheduled Macro Activities that are no longer associated with a Recurring Activity.

  1. Create a Backup.
  2. Open Control
  3. Click on Sales and Marketing
  4. Click on Recurring Activities
  5. Click on any Recurring Activity you want to remove.
  6. Click on the Delete button on the right side toolbar. Confirm any prompts to complete the deletion of the recurring activity.
  7. As a final step, any scheduled activities may need to be manually deleted if they still appear on the calendar. If so, the SQL statements below will identify any scheduled activities that are no longer associated with a Recurring Activity and remove them from the database via SQL.

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)
  • Entered : 1/7/2011
You could leave a comment if you were logged in.