Quote:
|
Originally Posted by GWilliy
Is it more performant to assign the GETDATE() to a @variable as in my example and use this in the filter.
|
Creating a @variable and assigning GetDate() to it also takes time. So if @variable would only be used once, I'd say using GetDate() will be faster.
Only if the current time is needed many times, you might notice a difference.
But then something else kicks in that is a lot more important than a few microseconds: If the code contains a number of scripts that use the current time, the value GetDate() will return between the first call and the last call will be different. Most likely that is undesired, unless you want to measure execution times.
Use a @variable when it is important that the GetDate() value is the same between multiple queries.
Quote:
|
Originally Posted by GWilliy
Have you considered using a calculated field for Column 1, negating the need to do any updates at all, not sure about any performance impact
|
How would that work? What would be the gain?