Todd Young-359443 (10/15/2012)
I was able to work at home this weekend and found the answer. When callingat UDF that does not access any database table and is used more like a macro,
the performance hit is negligible.
The raw difference in a 20,000 row dataset was 200 milliseconds. When I removed
the overhead of the three DateAdd functions it dropped to 100 milliseconds.
We are keeping the function in production and have dropped this as a candidate
for optimization.
I guess it really depends on what you call "negligible". You're talking about a function that runs twice as fast and that's not "negligible" especially when you consider that you're only working with 20,000 rows.
"Mind the pennies and the dollars will take care of themselves." 😉
--Jeff Moden
Change is inevitable... Change for the better is not.