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

You can always rephrase the line as:

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