• HildaJ (1/17/2013)


    Hard to maintain it's really not an option when it comes to working with databases, you got to do what you got to do. Data entered by users can be very tricky and whether you like it or not as a DBA your job is to maintain it, easy or difficult it's part of the job.

    What you have to consider is what's the simplest and better out of all the options. ChrisM's version believe it or not is easier and simpler to maintain than the version I wrote.

    BTW thanks ChrisM.

    You're welcome HildaJ. I can easily understand why you wrote this piece of code. Finding a date within a string is trivial if it's in a fixed format.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden