CASE Expressions

When creating a CASE expression for use with SQL Server (Transact-SQL), it must close with END. Not all literature on CASE expressions mentions this.

e.g.

SELECT act_no, prd_no, code, desc
FROM TmpClauses
WHERE product.prd_id = CASE WHEN prodType = 'HHH' THEN 'XX'
ELSE 'TT'
END

No Comments

Leave a reply