I am trying to create a function that will calculate the the OrderCost based on this formula
((1.0 – Discount) * (UnitPrice * Quantity))
Not sure where I am going wrong here.. I get this error message when trying to run the query
Msg 102, Level 15, State 1, Procedure OrderCost, Line 7 [Batch Start Line 0]
Incorrect syntax near '–'.
CREATE FUNCTION [dbo].[OrderCost] (@i INT)
RETURNS int
AS
BEGIN
DECLARE @OrderCost INT
SELECT @OrderCost = SUM((1.0 – Discount) * (UnitPrice * Quantity))
FROM OrderDetails
RETURN @OrderCost
END
Change the minus operator
'–'
to'-'