What's wrong with this code?
CREATE PROCEDURE Proc
(
@factura_id int, @produs_id int, @pret float, @cantitate int,@nr_ordine int
)
as
--declare @factura_id int, @produs_id int, @nr_ordine int, @pret float, @cantitate int
begin
if(((select COUNT (id_produs) from Produse where id_produs=@produs_id)=1))
insert into FacturaProdus(id_factura,id_produs,pret,cantitate,nr_ordine)
values(@factura_id,@produs_id,@pret, CONCAT ('-',convert(float,@cantitate),@nr_ordine))
else
begin
print 'hei'
end
end
I can't find a solution for this.When i execute it, it gives me:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'Proc'.
Msg 137, Level 15, State 2, Line 8
Must declare the scalar variable "@produs_id".
Msg 137, Level 15, State 2, Line 9
Must declare the scalar variable "@factura_id".
What to do?