Introduction:
In this article I will explain how to write SQL query to use case statement with select in SQL Server or case statement example in SQL Server.
In this article I will explain how to write SQL query to use case statement with select in SQL Server or case statement example in SQL Server.
Description:
In
previous posts I explained Distinct keyword with top statement, Replace function, substring function to get particular
part of string
and many articles relating to SQL
Server.
Now I will explain how to write query to use case statement in SQL
Server.
Generally
case statement is conditional statement that will return column value based on
the evaluation of set conditions. We can use CASE in statements such as
SELECT, UPDATE, DELETE and SET, and in clauses such as select_list, IN, WHERE,
ORDER BY, and HAVING.