I’m so tired of seeing this error:
Msg 102, Level 15, State 1, Procedure sp_reorder_quantity, Line 16
Incorrect syntax near ‘–’.
It states this because on line 16 where it states:
WHERE products.quantity_in_stock – products.reorder_level < @unit;
It’s saying that products.quantity_in_stock is: An expression of non-boolean type specified in a context where a condition is expected.
CREATE PROCEDURE sp_reorder_quantity
(
@unit int
)
AS
SELECT
products.product_id,
suppliers.name,
suppliers.address,
suppliers.city,
suppliers.province,
'qty' = products.quantity_in_stock,
products.reorder_level
FROM
suppliers
INNER JOIN
products ON suppliers.supplier_id = products.supplier_id
WHERE
products.quantity_in_stock – products.reorder_level < @unit;
GO
This may just be auto-formatting messing things up, but
–(“en dash”, U+2013) is not the same character as-(“hyphen-minus”, U+002D).Try changing it to:
This is easier to see if I put them right next to eachother: