• ben.brugman (3/1/2013)


    Jeff Moden (2/26/2013)


    Just be aware that string conversions of dates will be a bit slower than integer conversions. It'll take a million rows to notice a difference but every bit helps when you're working with large tables or millions of hits each day.

    I use string because that is much faster. If taken the total time I need to implement a query and execute a query for me working with strings is much faster in the end.

    If the query has to be executed lot's of times and on large tables sometimes it is worth investing the extra time to come up with a faster solution. (If the table is not in core (sorry memory), then the string handling probably does not matter.)

    Using the strings might even make the code more maintainable for others.

    But if the code is repeatedly used, other code might be more suetable.

    Ben

    (Sometimes investing in faster methods and then discovering that the time spend for this is not returned in the actual use;-)).

    Fortunately, you don't have to discover faster methods because I just handed one to you on a silver platter and you should incorporate it into your code library so you don't have to spend any time at it the next time you need it. 😉 The smart developer does spend some time learning new things to make it so they never have to hear the words "Hey! your code is slow!" from your boss.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)