• Can't say I am surprised by the outcome as everything that is converted to a varchar/string and back is bound to be inefficient.

    The datetimeform parts function doesn't have this conversion overhead as it works nativly on dates. On top of this, datetimefromparts obviously is more convenient in date construction then dateadd is, but that is not what is tested here. The speed when working on native dates is virtually identical.

    BTW, in some other earlier sparkle article I discovered that datediff had far better optimized special usage cases then some other, more straighforward functions for the job, like datepart.

    Here is the releveant link to the code:

    http://www.sqlservercentral.com/Forums/FindPost1051435.aspx

    I bet that if you replace some of the datepart logic you use to test datetimefromparts, you will see some extra performance. I suspect that using datepart is holding back the datetimefromparts function in this test.