Help on stored procedure

  • create proc myproc

    @MSBA_ID varchar(10),

    @Phase_ID int = null,

     @GSF int,

    @Note varchar(100)

    if exists (Select 1 from [dbo].[COST_Project_Phase]

       where MSBA_ID = @MSBA_ID and Project_Phase_ID = @Phase_ID)

    begin

    insert into dbo.[COST_Project_Phase](

     [MSBA_ID],

     [Gross_Square_Footage] ,

     [Phase_Note])

    values (@MSBA_ID, @GSF, @Note)

    set @Phase_ID = scope_identity()

    end

    else

    begin

    update dbo.[COST_Project_Phase]

     set [Gross_Square_Footage] = @GSF,

     [Phase_Note] = @Note

    where MSBA_ID = @MSBA_ID and Project_Phase_ID = @Phase_ID

    end

    Select * from [dbo].[COST_Project_Phase]

       where MSBA_ID = @MSBA_ID and Project_Phase_ID = @Phase_ID

    Russel Loski, MCSE Business Intelligence, Data Platform

  • thanks for the help

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply