Case null SQL Server 2008

How to check null in case argument in SQL Server 2008

+7
source share
3 answers
CASE WHEN column IS NULL THEN 1 ELSE 0 END 
+25
source

Someday you will need case isnull(column, 99) when 99 then "null" when 1 then ....

+5
source

Using case in Select Query:

Example:

 SELECT UserID, UserName, CASE(UserAmendId) AS UID WHEN 0 THEN 'True' ELSE 'False' END FROM UserTable 

It shows entries with the field UID = true, where its value = 0, otherwise it shows False, where its value is Null.

Table Name: UserTable
Columns: UserID (int), UserName (varchar (50)), UserAmendID (int)

-one
source

All Articles