Skip to content

ts.updatechroncontrolevent #12

@ecgrimm

Description

@ecgrimm

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions