title: Operand type clash: time is incompatible with int
body: <p>In a table, I have a column (AvgWaitTime) which stores data value in seconds (Data Type: float), date wise.  I have a function which performs some calculation using AvgWaitTime column and other few columns and returns a value in time format. I would to convert the value returned by the function (time format) into seconds (preferrably decimal, if not then int).</p>
  
  <pre><code>select 
  (datepart(HH, dbo.fnGetMonthlyAverageWaitTime(m.RDate) * 60 * 60) +
  datepart(mi, dbo.fnGetMonthlyAverageWaitTime(m.RDate) * 60) + 
  datepart(s, dbo.fnGetMonthlyAverageWaitTime(m.RDate)))[MonthlyAverageWaitTime]
  from TelephonyMTD m
  
  Error: Operand type clash: time is incompatible with int
  </code></pre>
  
  <p>So, I tried to run this:</p>
  
  <pre><code> select 
  (datepart(HH, GetDate() * 60 * 60) +
  datepart(mi, GetDate() * 60) + 
  datepart(s, GetDate()))
  </code></pre>
  
  <p>Now it says, Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query. Which is true when I looked at the data type conversion chart, I came to know that conversion to int and float is now allowed.</p>
  
  <p>Please advice.</p>