case null SQL Server 2008
How t开发者_运维百科o check for null in case statement in SQL Server 2008
CASE WHEN column IS NULL THEN 1 ELSE 0 END
Sometime you need case isnull(column, 99) when 99 then "null" when 1 then ....
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)
精彩评论