#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    154
    Rep Power
    14

    Problem Implementing Relational Trigger


    I'm having difficulty implementing a trigger in which I am trying to make sure that no trainee is registered as being present for a class at the same time as another class already registered for, in other words no trainee can be in more than 1 place simultaneously.

    The tables which the trigger is based around are:

    class(classno, time,...)
    register(traineeno, classno)


    Any ideas on what query I need to perform to get the correct behaviour?
    Last edited by markb_1984; November 24th, 2003 at 02:59 AM.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    United States
    Posts
    14
    Rep Power
    0
    could you create a UNIQUE constraint on [traineeno] AND [time] ?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    154
    Rep Power
    14
    Sorted it out using an IF EXISTS and linking class and register on classno and inserted and class on traineeno.

IMN logo majestic logo threadwatch logo seochat tools logo