Wht is error in this proc.

  • Create Procedure SPPS

    @Year1 int, @Year2 int ,@Year3 int ,@Year4 int ,@Subject1 int ,@Subject2 int, @Subject3 int, @Subject4 int

    AS

    BEGIN

     declare @Money int

     if exists (select Year, Subject from BarPieChart12 where Year=@Year1)

     (

      @Money = SELECT Subject from BarPieChart12 where Year=@Year1

      @Subject1 = @Money + @Subject1

      update BarPieChart12 set Subject1=@Subject1 where Year=@Year1

    &nbsp

     else

      INSERT INTO BarPieChart12 (Year,Subject) VALUES(@Year1,@Subject1);

    Plz it's URGENT

  • Create

    Procedure SPPS

    @Year1

    int, @Year2 int ,@Year3 int ,@Year4 int ,@Subject1 int ,@Subject2 int, @Subject3 int, @Subject4 int

    AS

    BEGIN

    declare @Money int;

    if exists (select Year, Subject from BarPieChart12 where Year=@Year1)

    BEGIN

    SET @Money = (SELECT Subject from BarPieChart12 where Year=@Year1);

    SET @Subject1 = @Money + @Subject1;

    update BarPieChart12 set Subject1=@Subject1 where Year=@Year1;

    END;

    ELSE

    BEGIN

    INSERT INTO BarPieChart12 (Year,Subject) VALUES(@Year1,@Subject1);

    END;

    END

    ;

  • I m very happy.

    Thanx

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

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