I have a product table with non-zero columns "quantity" (decimal) and "status" (int), and I created a view in this table with the following case expression:
SELECT P.ProductTypeId,
(CASE WHEN P.StatusId IN (5, 8) THEN 0 ELSE -P.Quantity END) AS Quantity,
...
FROM Product P
ProductTypeId is correctly deduced as nonzero. However, the Quantity column of this view is displayed as nullable, although the base columns are not null. That makes no sense to me.
I could use ISNULL / COALESCE to provide a default value in this case and force non-emptiness, but there is no meaningful default value, and this should not come primarily from what I understand. Any ideas what is going on?
source
share