title: IF ELSE STATEMENT in stored procedure
body: <p>I am trying to write a stored procedure, but I get an error</p>
  
  <blockquote>
    <p>Incorrect syntax near ';'</p>
  </blockquote>
  
  <p>I think there is something wrong with the <code>IF Else</code> statements.</p>
  
  <pre><code>CREATE PROCEDURE setSystemStaff
      @SYSTEMNAME nvarchar(50),
      @STAFFNAME nvarchar(50),
      @SYSTEMSTAFFROLE nvarchar(50)
  AS
  BEGIN
      SET NOCOUNT ON;
  
      WITH t1 (SYSTEMID) AS 
      (
          SELECT SYSTEMID 
          FROM SYSTEM 
          WHERE SYSTEMNAME = @SYSTEMNAME
      ), t2 (STAFFID) AS 
      (
          SELECT STAFFID 
          FROM STAFF 
          WHERE STAFFNAME = @STAFFNAME
      );
  
      IF @SYSTEMSTAFFROLE = 'Owner'
          INSERT INTO SYSTEMSTAFF ([SYSTEMID], [SYSTEMSTAFFOWNER])    
              SELECT t1.SYSTEMID, t2.STAFFID 
              FROM t1, t2
      ELSE IF @SYSTEMSTAFFROLE = 'Specialist'
          INSERT INTO SYSTEMSTAFF ([SYSTEMID], [SYSTEMSTAFSPECIALIST])    
              SELECT t1.SYSTEMID, t2.STAFFID 
              FROM t1,t2  
      ELSE 
          RETURN  
  END
  GO
  </code></pre>