This query requires editing of information before being executed.
This works for clearing any invalid event in the dbo.EventSchedule table.
Event Type A – NOT
Event Type B – LTC/LTO
Clearing an old/duplicate NOT signal out of the SQL server- (for Example purposes using SN1734)
First, you want to find out the AccountID for the account you are checking. To do that, you will need to go to Tables>dbo.AccountMain, right click and Select Top 1000 Rows. At the bottom of the query, enter
WHERE AccountNumber = ’06-00-5154’ (account number is editable), then make sure the database is correct (SIMSData) and hit Execute. This will show you which is the active AccountID in SIMS.
Go to Tables>dbo.EventSchedule in the database within the SQL server, right click and Select Top 1000 rows. At the bottom of the SQL query, after [EventSchedule], enter
WHERE AccountNumber = ’06-00-5154’ (account number is editable), then make sure the database is correct (SIMSData) and hit Execute.
If there are two entries for NOT (there could be multiple entries for LTC/URS/LTO), then you will need to delete the entry for the “inactive” account
Now, to remove the duplicate/not needed entry, go back to the initial SQL query, remove Select TOP 1000 through , [DateTimeStamp]

Then Add DELETE before FROM and change AccountNumber to AccountID and change the Account Number to the Inactive Account ID .


Then it should say (1 row(s) affected)
(If there are more events than the NOT, there is additional information to add to the query)
For instance, a WHERE statement for the ScheduleType will need to be added.