私はこのエラーを見るのにとてもうんざりしています:
メッセージ 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