1
This code generates the following error:
Msg 156, Level 15, State 1, Procedure totalGastoPedido, Line 7 Incorrect syntax near the keyword 'FROM'.
CREATE FUNCTION dbo.totalGastoPedido(@id_mesa int)
RETURNS int
AS
BEGIN
DECLARE @Total money
SET @Total = (SELECT SUM(ped.ValorPagar))
FROM Pedido ped
where @id_mesa = IdMesa
and ped.Data>'2016-02-10' and ped.Data<'2016-02-10'
RETURN @Total
END
Can you explain the question better? What’s the problem, what’s the mistake? What are you trying to do?
– Sergio
This is in sql server?
– rray
I’m sorry I didn’t write in full, I plan to make a Function that receives the Id from the table and returns the total spent from that table in a given period
– Alexandru
And yes it is SQL SERVER, I am begginer in sql server
– Alexandru
When having compile the error appears in FROM
– Alexandru
Edit the question, scan the error message, sql server tag tbm.
– rray
Msg 156, Level 15, State 1, Procedure totalGastoPedido, Line 7 Incorrect syntax near the keyword 'FROM'.
– Alexandru
@Alexandru can [Dit] the question and gather this information?
– Sergio