DF185: ELSE NULL is used in CASE expression.
Last modified: May 28, 2025
The topic describes the DF185 T-SQL code analysis rule.
Category
BEST PRACTICE
Message
ELSE NULL is used in CASE expression.
Description
It is recommended to omit the ELSE NULL statement in the CASE expression as it will still return NULL as default value.
Noncompliant code example
SELECT CASE WHEN Qty < 10 THEN 'Low' ELSE NULL END AS prt_level
FROM dbo.Storage
GO
Compliant solution
SELECT CASE WHEN Qty < 10 THEN 'Low' END AS prt_level
FROM dbo.Storage
GO
Was this page helpful?
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.