DF185: ELSE NULL is used in CASE expression.

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

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Studio in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Studio for your business, request a demo to see it in action.
Ready to start using dbForge Studio for SQL Server?