-- ================================================ -- Template generated from Template Explorer using: -- Create Inline Function (New Menu).SQL -- -- Use the Specify Values for Template Parameters -- command (Ctrl-Shift-M) to fill in the parameter -- values below. -- -- This block of comments will not be included in -- the definition of the function. -- ================================================ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE FUNCTION Rij ( -- Add the parameters for the function here @att1 varchar(50), @att2 varchar(50) ) RETURNS INT AS BEGIN DECLARE @Rij INT; SELECT @Rij = count(*) FROM ( SELECT distinct a1.idEvent as id1, a2.idEvent as id2 FROM events as e1, events as e2, correlationAttributes as a1, correlationAttributes as a2 WHERE a1.attribute = @att1 and a2.attribute = @att2 and a1.value=a2.value --AND a1.value<>'' AND a1.value IS NOT NULL AND a1.idEvent<>a2.idEvent AND a1.idEvent=e1.id AND a2.idEvent=e2.id AND e1.timestamp