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 |  
                                    | cplusplusAged Yak Warrior
 
 
                                        567 Posts | 
                                            
                                            |  Posted - 2014-07-28 : 11:39:32 
 |  
                                            | I have the following decode used in oracle, what will be the quivalent in sql server. i tried to use with case but getting errors:sum(decode(T_STATISTIC_INPUT.Sub_Account, 99000006, MTH_VALUE)) APDusing the following but getting error:CASE T_STATISTIC_INPUT.Sub_Account			WHEN 99000006 THEN  sum(Mth_Value)			ELSE sum(0)		END as APDThanks a lot for the helpful info. |  |  
                                    | MichaelJSQLConstraint Violating Yak Guru
 
 
                                    252 Posts | 
                                        
                                          |  Posted - 2014-07-28 : 12:08:37 
 |  
                                          | In SQL SERVER 2008 : you could do the following:	 SUM( 		  CASE T_STATISTIC_INPUT.Sub_Account 		  WHEN 99000006 THEN MTH_VALUE		  ELSE 0 		  END		)In this case: if your value for the Sub_Account 99000006  it will sum the MTH_VALUE Else it will be 0 |  
                                          |  |  |  
                                |  |  |  |