Freelancer
Freelancer

Reputation: 9074

Not able to detect error in stored procedure

I am new with stored procedure.

I have written the following stored procedure:

create proc sp_TaxBrock
as
BEGIN
   Declare @intTax int,@intBrockrage int,@sum int
   set @intTax = (select Tax from partyRegister where partyCode = '0L036')
   set @intBrockrage = (select brockrage from partyRegister where partyCode = '0L036')

   set @sum = @intTax+@intBrockrage

   select @sum
   print @sum
   /*print @intTax+@intBrockrage;*/
go

It is causing this error:

Msg 102, Level 15, State 1, Procedure sp_TaxBrock, Line 12
Incorrect syntax near '@sum'.

Not able to find what is mistake.

I tried by adding semicolons (;) at different locations, but still the error is same.

Please help me.

Upvotes: 0

Views: 99

Answers (1)

TechDo
TechDo

Reputation: 18629

Add an end before go.

create proc sp_TaxBrock
as
BEGIN

  Declare @intTax int,@intBrockrage int,@sum int
  set @intTax =(select Tax from partyRegister where partyCode='0L036')
  set @intBrockrage=(select brockrage from partyRegister where partyCode='0L036')

  set @sum = @intTax+@intBrockrage

  select @sum
  print @sum
/*print @intTax+@intBrockrage;*/
end
go

Upvotes: 6

Related Questions