A Little About Date Math In SQL Server Queries
Going Further
If this is the kind of SQL Server stuff you love learning about, you’ll love my training. I’m offering a 75% discount to my blog readers if you click from here. I’m also available for consulting if you just don’t have time for that, and need to solve database performance problems quickly. You can also get a quick, low cost health check with no phone time required.
Missing Index hints should just be a table name if they can’t make them any more helpful than that. Azure SQL Database’s Automatic Index Tuning recommendations are better, but still not great.
With all the limitations and the general quality of the suggestions, I think we’d be better off without them period.
Goodmorning Erik,
I’ve tested a bit with what u showed in this video.
But the moment i try to use a variable datetime it wil scan the whole table.
how would you write your query with variable value?
It’s hard to say if it’s because of the local variable or not. You could try a recompile hint.
If it’s more complicated than that, you should ask a question here: https://dba.stackexchange.com/
Thanks!