2

私はこのエラーを見るのにとてもうんざりしています:

メッセージ 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
4

2 に答える 2

5
于 2012-12-10T21:54:00.370 に答える
0

この行はいつでも次のように言い換えることができます。

WHERE                   products.quantity_in_stock < products.reorder_level + @unit;
于 2012-12-10T21:55:38.480 に答える