-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I tested ts.updatechroncontrolevent on tilia-dev and attempted to replace an event with another one. But instead it added the event. I tried twice, so now there are three events assigned to the chroncontrolid. The SQL Server SP first checks whether there's an event assigned. If not, in inserts a new one; if so, it updates it. Here's the SQL Server code:
CREATE PROCEDURE [TS].[UpdateChronControlEvent](@CHRONCONTROLID int, @EVENTID int, @ANALYSISUNITID int = null)
AS
DECLARE @EVENTCHRONID int
SET @EVENTCHRONID = (SELECT EventChronologyID FROM NDB.EventChronology WHERE (ChronControlID = @CHRONCONTROLID))
IF @EVENTCHRONID IS NULL
BEGIN
INSERT INTO NDB.EventChronology (AnalysisUnitID, EventID, ChronControlID)
VALUES (@ANALYSISUNITID, @EVENTID, @CHRONCONTROLID)
END
ELSE
BEGIN
UPDATE NDB.EventChronology
SET AnalysisUnitID = @ANALYSISUNITID, EventID = @EVENTID, ChronControlID = @CHRONCONTROLID, Notes = NULL
WHERE EventChronologyID = @EVENTCHRONID
END
Metadata
Metadata
Assignees
Labels
No labels