Ok I'm having a problem generating a report that will concatenate the Trapvarbinds.OIDValue
I've written the following custom report, but I'm having a problem getting it to work using the Report Writer. The result is schewed because for every TrapIndex it is duplicating the message. How can I correct this problem? (I.E - if I have 5 entries for each OIDVALUE it is duplicating the concatenated entry 5 times in the final report row.)Is there a better way to write this report?
SET NOCOUNT ON
Declare @OIDValue varchar(8000)
Select DISTINCT @OIDValue = ISNULL(@OIDVALUE + ' ','') + OIDVALUE from trapvarbinds,traps where trapvarbinds.trapid = traps.trapid
SELECT TOP 25
Traps.DateTime AS Date_Time,
Traps.Hostname AS HostName,
@OIDVALUE AS Message,
Traps.Tag AS SNMP_Tag,
Traps.TrapID AS Trap_ID
FROM
Traps, Trapvarbinds
WHERE
(
( DateTime BETWEEN 39923.4166666667 AND 39924.4583333333 )
)
AND
(
(Traps.Tag = 'Alert')
)
AND
(
(Traps.TrapID=TrapVarbinds.TrapID)
)
ORDER BY DateTime DESC, Message DESC