title: why does this function not return decimal?
body: <p>I want this function to take a datetime and return the time expressed as a decimal.  E.G. - 2:33 PM would be returned as 14.55</p>
  
  <pre><code>ALTER FUNCTION [dbo].[GetTimeAsDecimal](
  @DateTime as datetime
  ) RETURNS decimal
  AS
  BEGIN
  DECLARE @hour decimal
  DECLARE @min decimal
  DECLARE @result decimal
  SELECT @hour = DATEPART(HOUR, @DateTime)
  SELECT @min = (DATEPART(MINUTE, @DateTime)/60.0)
  SELECT @result = @hour + @min 
  RETURN @result
  END
  </code></pre>
  
  <p>A similar query produces the results expected...</p>
  
  <pre><code>SELECT DATEPART(HOUR, getDate()) + (DATEPART(MINUTE, getDate())/60.0)
  </code></pre>