title: SQL view infers nullable column from non-null table?
body: <p>I have a Product table with non-null "quantity" (decimal) and "status" (int) columns, and I created a view on this table with the following case expression:</p>
  
  <pre><code>SELECT P.ProductTypeId,
         (CASE WHEN P.StatusId IN (5, 8) THEN 0 ELSE -P.Quantity END) AS Quantity,
         ...
  FROM Product P
  </code></pre>
  
  <p>ProductTypeId is correctly inferred as non-null. However, the Quantity column of this view is inferred as nullable, even though the underlying columns are not nullable. This doesn't make any sense to me.</p>
  
  <p>I could use ISNULL/COALESCE to provide a default value in this case and force non-nullability, but there is no meaningful default value, and this shouldn't happen in the first place from what I understand. Any ideas what's going on?</p>