I have this query below and I keep getting an error
Arithmetic overflow error converting expression to data type datetime error
when executing. I am pretty sure it has to do with DATE_ID =
etc etc, because every time I put in a timestamp in their it works. Can anyone help me ?
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]
GETDATE
to varchar when theDATEADD
will convert it again to datetime? – Serpiton 20 hours ago