Say, for example, I am joining a table of numbers to perform some operation between two dates in a subquery, for example:
select n ,(select avg(col1) from table1 where timestamp between dateadd(minute, 15*n, @ArbitraryDate) and dateadd(minute, 15*(n+1), @ArbitraryDate)) from numbers where n < 1200
Will the query work better if, for example, I built a date from the varchars concatenation than using the dateadd function?
performance sql sql-server tsql
Daniel
source share