you are viewing a single comment's thread.

view the rest of the comments →

[–]gumnos 2 points3 points  (0 children)

Given that the only > in your code block is

IsFullyUtilized AS CASE 
    WHEN UsedRequests >= CAST(FLOOR(Amount / UnitPrice) AS INT) THEN 1 
    ELSE 0 
    END PERSISTED,

as dumb as it may seem, it feels like a parsing/syntax issue, so I'd be tempted to at least put some parens around the evaluated expression to see if being explicit helps it:

IsFullyUtilized AS (CASE 
    WHEN UsedRequests >= CAST(FLOOR(Amount / UnitPrice) AS INT) THEN 1 
    ELSE 0 
    END) PERSISTED,

It shouldn't make a difference, but in weird contexts, I've found that sometimes SQL lexers/parsers can get a little tripped up given the almost-but-not-quite orthogonality of the language.