Search Results

Search found 1 results on 1 pages for 'sjemmie'.

Page 1/1 | 1 

  • SQL and multiple statements in stored procedure

    - by Sjemmie
    I'm working on SQL server 2005 and I have a very simple stored procedure: 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 My question is: is it posible to have multiple queries in my stored procedure ? I want to add the lines UPDATE tblTabelB SET ID = @ID,code = @Code WHERE ID = @ID UPDATE tblTabelC SET ID = @ID,code = @Code WHERE ID = @ID in my if exists section. How do I change my stored procedure in the correct way ?

    Read the article

1