title: Constraint on table to limit number of records to be stored
body: <p>I have a database and there are two tables <code>Ads</code> and <code>Images</code>. There is a primary key <code>adid</code> in <code>Ads</code> table which is a foreign key in <code>Images</code> table.</p>
  
  <p>I want to created a constraint on table <code>Images</code> that not more than 5 <code>adid</code> can be stored in <code>Images</code> table.</p>
  
  <p>I need to know what this type of constraint is called and how I can accomplish this with query in SQL Server.</p>