|
Posted by Erland Sommarskog on 06/04/07 21:36
Techhead (jorgenson.b@gmail.com) writes:
> Somebody at work told me to use this:
>
> SELECT CASE WHEN P.STATE IS NULL THEN '' ELSE P.STATE END
>
> It seems to work. Is this similar as to what is described above?
Yes, coalesce is a shortcut for the above. The nice thing with coalesce is
that it accept a list of values, and will return the first value that
is non-NULL.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|