-- ================================================ -- Template generated from Template Explorer using: -- Create Procedure (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 procedure. -- ================================================ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE PROCEDURE InitialAtomicConditions AS BEGIN DECLARE @att1 VARCHAR(50); DECLARE @att2 VARCHAR(50); DECLARE attributes1 CURSOR FOR SELECT distinct attribute FROM CorrelationAttributes DECLARE attributes2 CURSOR FOR SELECT distinct attribute FROM CorrelationAttributes OPEN attributes1 FETCH NEXT FROM attributes1 into @att1; DELETE FROM ComplexL2Conditions; DELETE FROM ComplexConditions; DELETE FROM AtomicConditions; WHILE @@fetch_status = 0 BEGIN OPEN attributes2 FETCH NEXT FROM attributes2 into @att2; --INSERT INTO AtomicConditions (attribute1, attribute2) VALUES (@att1, @att2); WHILE @@fetch_status = 0 BEGIN IF (((SELECT COUNT(*) FROM AtomicConditions WHERE attribute1=@att2 AND attribute2=@att1)=0) AND ((SELECT COUNT(*) FROM AtomicConditions WHERE attribute2=@att2 AND attribute1=@att1)=0)) INSERT INTO AtomicConditions (attribute1, attribute2) VALUES (@att1, @att2); FETCH NEXT FROM attributes2 into @att2; END; CLOSE attributes2; FETCH NEXT FROM attributes1 into @att1; END; CLOSE attributes1; DEALLOCATE attributes1; DEALLOCATE attributes2; EXEC RemoveDuplicatesFromAtomicConditions; END GO