trigger writing

  •   Hi could anyone help me out with syntax problems?

    The intersects function returns 1 if the 2 time intervals supplied share a timepoint

    Cheers!  Ehsan

    CREATE TRIGGER dupcontcirc ON lecturer_email_during

    FOR INSERT

    AS

    if (SELECT * FROM INSERTED i

    WHERE LID IN

    (SELECT LID FROM lecturer_email_during l

    WHERE

    i.email = l.email

    AND

    dbo.intersects(i.during, l.during))

    if = 1

    BEGIN

       ROLLBACK

       RAISERROR('duplicate tuples in database')

    END

     

    error line 10 and line 14

  • Not exactly sure what the logic is but here is what I believe you are trying to accomplish:

    CREATE TRIGGER dupcontcirc ON lecturer_email_during

    FOR INSERT

    AS

    if exists(SELECT * FROM

              INSERTED i join lecturer_email_during l on i.LID  = l.LID

              and i.email = l.email

              where dbo.intersects(i.during, l.during) = 1)

    BEGIN

       ROLLBACK

       RAISERROR('duplicate tuples in database')

    END


    * Noel

  • hey thanks for your help

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply