Getting maximum value of float in SQL programatically
        Posted  
        
            by Axarydax
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Axarydax
        
        
        
        Published on 2010-04-23T15:50:24Z
        Indexed on 
            2010/04/23
            15:53 UTC
        
        
        Read the original article
        Hit count: 255
        
Is there an method for programatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#.
I would like to use it in some selection when the parameter does not equal any actual values in the database, so I would use something like
declare @min float
declare @max float
/*fill @min and @max, can be null if undefined*/
select * from foo 
  where bar between isnull(@min,0 ), isnull(@max,max(float)/*magic*/)
Thanks
© Stack Overflow or respective owner