Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 COALESCE

Author  Topic 

charul
Starting Member

18 Posts

Posted - 2008-07-17 : 00:57:24
I am unable to understand the function of Coalesce. I have seen it being used in a lot of places. Can anybody explain to me.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-17 : 00:59:59
Have you try check that on the Books OnLine ? http://msdn.microsoft.com/en-us/library/ms190349.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-17 : 01:27:32
What's is that you dont understand from books online description?
Go to Top of Page

charul
Starting Member

18 Posts

Posted - 2008-07-17 : 03:35:31
quote:
Originally posted by visakh16

What's is that you dont understand from books online description?



does it check for the first non null apperance?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-17 : 03:38:51
yes. It return the first NON NULL value


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-17 : 03:51:31
its an equivalent of CASE WHEN. it can be thought of as
COALESCE(col1,col2,col3,...) equivalent to

CASE WHEN col1 IS NOT NULL THEN col1
WHEN col2 IS NOT NULL THEN col2
WHEN col3 IS NOT NULL THEN col3
...
END
Go to Top of Page
   

- Advertisement -