# Home

## CASE expressions should not have too many WHEN clauses

Rule description

- CASE expressions should not have too many WHEN clauses

**Non-compliant Code Example **

SELECT CASE WHEN Quantity > 10 THEN 'The quantity is greater than 10' WHEN Quantity > 20 THEN 'The quantity is greater than 20' WHEN Quantity > 30 THEN 'The quantity is greater than 30' WHEN Quantity > 40 THEN 'The quantity is greater than 40' WHEN Quantity > 50 THEN 'The quantity is greater than 50' WHEN Quantity > 60 THEN 'The quantity is greater than 60' WHEN Quantity > 70 THEN 'The quantity is greater than 70' WHEN Quantity > 80 THEN 'The quantity is greater than 80' WHEN Quantity > 90 THEN 'The quantity is greater than 90' WHEN Quantity > 100 THEN 'The quantity is greater than 100' WHEN Quantity > 110 THEN 'The quantity is greater than 110'--Non compliant codeWHEN Quantity = 120 THEN 'The quantity is 120'--Non compliant codeELSE 'The quantity is under 10' END AS QuantityText FROM NewOrderDetails