title: Sql Insert Trigger with counts
body: <p>I need to create a trigger for a database I'm currently working on but have very little experience creating these. The trigger is for an insert command but if the number of inserts on one UserId is higher than 30 I need to add anything after that to another table called audit. Where would I start?</p>
  
  <pre><code>CREATE  TRIGGER trigger_audit
  On INSERT
     ON Persons
     [ FOR EACH ROW ]
  DECLARE
     -- variable declarations
  BEGIN
     -- trigger code
  EXCEPTION
     WHEN ...
     -- exception handling
  END;
  </code></pre>