title: Create trigger prevent insert
body: <p>I'm trying to execute the following trigger: </p>
  
  <pre><code>create trigger t23 
  on studies
  after insert, update, delete 
  as
  begin
  REFERENCING NEW ROW NewStudent
  FOR EACH ROW
  WHEN (30 &lt;= (SELECT SUM(credits) FROM Studies)
  DELETE FROM NewStudent N
  WHERE N.spnr = NewStudent.spnr 
  end
  </code></pre>
  
  <p>I'm trying to create a trigger which only inserts a student if the credits is &lt; or == to '30'. The "Credits" is a type int. </p>
  
  <p>I'm getting numerous errors trying to implement this trigger. I really have tried everything and i m out of options. Could someone who is expert in the field point me in the right direction? </p>