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.
Author |
Topic |
lizzie88
Starting Member
2 Posts |
Posted - 2010-11-19 : 13:53:02
|
Hi,this is the first time I'm posting on this forum but I am stuck with a silly problem.I have rows which have columns in integer format. I need to get the total into a new column. My problem is that there is no ISNULL in SQL CE so I tried something like(CASE WHEN [Courtesy] IS NULL THEN 0 ELSE [Courtesy] AS Col1) +(CASE WHEN [PositiveAttitude] IS NULL THEN 0 ELSE [PositiveAttitude] AS Col2)AS SUMValuesI only get the error saying that there was a problem parsing the query in SQL CE or Oncorrect syntax near the word AS in SQL Server. I don't know how to set it to 0 if it's null without using the ISNULL function. Unfortunatelly I can't set the default value to 0 in order to always have a non null value.Thanks for your help. |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-11-19 : 14:01:18
|
you're missing the END keyword to your case ststements.SELECT CASE WHEN [Courtesy] IS NULLTHEN 0ELSE [Courtesy]END |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-11-19 : 14:02:11
|
is COALESCE function available in CE?checked...it is. use that.http://msdn.microsoft.com/en-us/library/ms174075(SQL.90).aspx |
|
|
lizzie88
Starting Member
2 Posts |
Posted - 2010-11-19 : 14:09:42
|
I am so ashamed about the mising END. I will give a try the coalesce as well but it seems to be workingThanks both of you |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-11-19 : 15:18:22
|
you're welcome, from both of us |
|
|
|
|
|