How to check for null in case statement in SQL Server 2008
Asked
Active
Viewed 2.4k times
3 Answers
5
Sometime you need case isnull(column, 99) when 99 then "null" when 1 then ....

pinichi
- 2,199
- 15
- 17
-
Do you know why this is true? My SQL database will not accept "case when data is null" at all. – Ross Brasseaux Jan 04 '13 at 20:31
-1
Using Case in Select Query:
Example:
SELECT UserID, UserName, CASE(UserAmendId) AS UID WHEN 0 THEN 'True' ELSE 'False' END
FROM UserTable
It shows records with field UID=true where its Value=0, otherwise it show False where its Value is Null.
Table Name: UserTable
Columns: UserID (int), UserName (varchar(50)), UserAmendID (int)

Aziz Shaikh
- 16,245
- 11
- 62
- 79

Riya
- 1