Error SQL70001: This statement is not recognized in this context

This error is due to the fact that Build Action is set To Build inside the Properties. Set it to None and it should work fine. enter image description here


As you posted it, there's a comma missing between the first two elements in your SELECT:

select 
    @Advance_payment = [advance_payment] @Balance = [Balance], 
                                       ^^^^
                                        | 
                                      here there should be a comma!

So try this instead:

select 
   @Advance_payment = [advance_payment],
   @Balance = [Balance], 
   ..... (rest of your statement) ....