我厌倦了看到这个错误:
消息 102,级别 15,状态 1,过程 sp_reorder_quantity,第 16 行
“–”附近的语法不正确。
它说明了这一点,因为在第 16 行它指出:
WHERE products.quantity_in_stock – products.reorder_level < @unit;
据说products.quantity_in_stock
是: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