title: Arithmetic overflow error converting expression to data type datetime [SQL SERVER 2008 R2]
body: <p>I have this query below and I keep getting an error</p>
  
  <blockquote>
    <p>Arithmetic overflow error converting expression to data type datetime error </p>
  </blockquote>
  
  <p>when executing. I am pretty sure it has to do with <code>DATE_ID =</code> etc etc, because every time I put in a timestamp in their it works. Can anyone help me ?</p>
  
  <pre><code>SELECT 
      Dimension.[Every 10 minutes], 
      COUNT(*) as [Number of Transactions], 
      df.[Function Name]
  FROM 
      dbo.table, Dimension, DimensionFunction df
  WHERE 
      DATE_ID = DATEADD(day, -1, convert(varchar(50), GETDATE(),20))
      AND dbo.table.TIME = Dimension.Time
      AND df.FUNCTION_CODE = dbo.table.FUNCTION_CODE
      AND INTERFACE_ID = 2
      AND dbo.table.FUNCTION_CODE in ('ABX', 'BBB','DDD','EEE')
      AND TABLE.TIME BETWEEN '07:00' and '17:59'
  GROUP BY
      Dimension.[Every 10 minutes], df.[Function Name]
  ORDER BY
      Dimension.[Every 130 minutes], df.[Function Name]
  </code></pre>