title: SQL and multiple statements in stored procedure
body: <p>I'm working on SQL server 2005 and I have a very simple stored procedure:</p>
  
  <pre><code>create PROCEDURE [dbo].[tblTabel_Insert] 
  @ID int,
  @Code nvarchar(50) = null
  AS
      SET NOCOUNT ON;
  
    IF  EXISTS (SELECT ID, code FROM tblTabel WHERE ID = @ID and code = @Code) 
      UPDATE tblTabel SET ID = @ID,code = @Code WHERE ID = @ID
  
  ELSE
  BEGIN
  
  INSERT INTO tblTabel (ID,code) VALUES ( @ID ,@Code);
  END
  </code></pre>
  
  <p>My question is: is it posible to have multiple queries in my stored procedure ?
  I want to add the lines </p>
  
  <pre><code>UPDATE tblTabelB SET ID = @ID,code = @Code WHERE ID = @ID
  UPDATE tblTabelC SET ID = @ID,code = @Code WHERE ID = @ID
  </code></pre>
  
  <p>in my if exists section. How do I change my stored procedure in the correct way ?</p>