dcsimg

Incorrect syntax near … occurred while running a SQL Query

Products

Webtrends Analytics 9.x
Webtrends Analytics 8.x

Issue

You receive an error similar to the following when viewing the list of scheduled reports or active alerts:

Incorrect syntax near ‘ue7m1M63F6W$T9ue7m1M63F6W$TNW$T1’ occurred while running a SQL Query (see SQL in log file)

Resolution

This is caused by erroneous entries linked to the wt_event table. You can either clear the specific entries for that event or truncate the WT_MonitorResult table.

To remove the entries for the single event, execute the following queries: (replace ue7m1M63F6W$T9ue7m1M63F6W$TNW$T1 with the value displayed in the error you received)

DELETE from wt_sched.dbo.WT_MonitorAlertResolveHistory where MonitorResultID in
(select MonitorResultID from wt_sched.dbo.WT_MonitorResult where EventID in
(select EventID from wt_sched.dbo.WT_Event where ProfileName = ‘ue7m1M63F6W$T9ue7m1M63F6W$TNW$T1’))

DELETE from wt_sched.dbo.WT_taskchronicle where EventID in
(select EventID from wt_sched.dbo.WT_Event where ProfileName = ‘ue7m1M63F6W$T9ue7m1M63F6W$TNW$T1’)

To truncate the wt_MonitorResult table run the following queries:

DELETE FROM wt_sched.dbo.WT_MonitorResultAction;
DELETE FROM wt_sched.dbo.WT_MonitorAlertResolveHistory;
DELETE FROM wt_sched.dbo.WT_MonitorResult;

Executing these three queries will also remove all active, deferred and past alerts from the user interface.