title: How to create a stored procedure to assign age categories to a person age
body: <p>I'm doing an assignment for a class where I should determine if the person's age is between one of the following categories and insert the appropriate values:</p>
  
  <pre><code>0 – 12 – Child
  13 – 19 – Teenager
  20 + Adult.
  </code></pre>
  
  <p>I am aware that it is much easier to use a case option but it is required that I use if statements. I already have a table called marketing list where I altered and added the age and age category columns. Can anyone help me out please?</p>
  
  <pre><code>alter table marketing_list
      add age integer, 
          age_category varchar(20)
  
  Create Procedure Age_Range
  (
      @Id         integer,
      @Name       varchar(20),
      @DOB        date,
      @Parish     varchar(20),
      @Mobile     integer,
      @Mobile_Provider    varchar(7)
  )
  As
  Begin
      update marketing_list 
      Set age = DATEDIFF(year, Date_of_Birth, GETDATE())
  
      If (DATEDIFF(year, @DOB,GETDATE()) &gt; 0 and (DATEDIFF(year, @DOB, GETDATE()) &lt;= 12))
      Begin
          update marketing_list 
          Set age_category = 'Child'
      End
  End
  </code></pre>