• Lynn Pettis (3/1/2013)


    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;-)).

    I'll have to disagree with you and side with Jeff. I have learned much from him and scalability and reuse actually come hand in hand. If you take the time now to build scalable code (read routines) that can be reused then spend the time. Just because it is good enough for a particular use does not mean it will be for another. Many times people will take what you have written and use it where it really shouldn't because it was just good enough for that one instance.

    Code reuse is another tricky subject. It generally gets talked about far more often than it is genuinely done. A few developers are bad enough, but trying to get hundreds of developers to build and use reuseable code is like trying to get Congress to agree on something.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.