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  | 
                             
                            
                                    | 
                                         sql_chaser 
                                        Starting Member 
                                         
                                        
                                        33 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2014-12-12 : 16:14:18
                                            
  | 
                                             
                                            
                                            | Please let me know if there are any function to get the greatest date value in row in 2008. I have around 20-30 date fields to compare in row.Thanks a lot for all the help | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     ScottPletcher 
                                    Aged Yak Warrior 
                                     
                                    
                                    550 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-12-12 : 16:36:05
                                          
  | 
                                         
                                        
                                          | No, there are no built-in functions to do that.Probably the easiest and most efficient way would be to use a CROSS APPLY containing MAX() against a pseudo-table loaded with a multi-value VALUES clause.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     sql_chaser 
                                    Starting Member 
                                     
                                    
                                    33 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-12-12 : 16:37:10
                                          
  | 
                                         
                                        
                                          | Thanks a lot...I tried this little code and looks like it's working :SELECT  t.colA , t.colB , ( SELECT    MAX(RowVals) AS MaxRowVals     FROM      ( VALUES ( colA), ( colB) ) AS t1 ( RowVals )    ) AS RowMax FROM    #table AS t  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |