Question : Code in SQL 2000 not parsing/running in SQL 2005 Query Analyzer

I have checked this already: http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_22554152.html?sfQueryTermInfo=1+10+2000+2005+30+code+doesnt+sql+work

The code below parses/executes fine in SQL 2000 but not in 2005 I looked at the Syntax in SQL 2005 online books still cant fix:

select A.ClientID, A.ClientSince,
 sum(case when B.ProductCode = 'Product1' then 1 end) Product1,
 sum(case when B.ProductCode = 'Product2' then 1 end) Prodcut2
from clients A
left join accounts B on A.ClientID = B.ClientID
WHERE (A.ClientSince <= CONVERT(DATETIME, '2010-07-01 00:00:00', 102))
AND   (B.CommenceDate <= CONVERT(DATETIME, '2010-07-01 00:00:00', 102))
AND B.AccountBal > 0
group by A.ClientID, A.ClientSince
order by A.ClientID

the error is: Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ' '.

which is on the line:  sum(case when B.ProductCode = 'Product1' then 1 end) Product1,

when I run without the case statements it works fine - anyone know how to fix ???

Answer : Code in SQL 2000 not parsing/running in SQL 2005 Query Analyzer

Above code should work in SQL Server 2005 and try this
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
select A.ClientID, A.ClientSince,
 sum(case when B.ProductCode = 'Product1' then 1 else 0 end) Product1,
 sum(case when B.ProductCode = 'Product2' then 1 else 0 end) Prodcut2
from clients A
left join accounts B on A.ClientID = B.ClientID
WHERE (A.ClientSince <= CONVERT(DATETIME, '2010-07-01 00:00:00', 102))
AND   (B.CommenceDate <= CONVERT(DATETIME, '2010-07-01 00:00:00', 102))
AND B.AccountBal > 0
group by A.ClientID, A.ClientSince
order by A.ClientID
Random Solutions  
 
programming4us programming4us