TSQL Challenge 78 - Parse single field into multiple fields

  • jacob sebastian

    SSChampion

    Points: 11812

    Comments posted to this topic are about the item TSQL Challenge 78 - Parse single field into multiple fields

    .

  • Jeff Moden

    SSC Guru

    Points: 994293

    This is another contest problem where the best solution wouldn't likely be an "all in one" query.

    --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.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

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

  • Mike Dougherty-384281

    SSCrazy

    Points: 2764

    Jeff Moden (3/19/2012)


    This is another contest problem where the best solution wouldn't likely be an "all in one" query.

    I suggest the schema should be redesigned and this code would be part of a one-time fix to populate new tables rather than part of ongoing reporting.

    I know... this is a vendor's application, entrenched business, just get it done "for today", and a dozen other reasons why we all still have jobs dealing with other people's implementation choices. 🙂

  • Sean Lange

    SSC Guru

    Points: 286411

    LOL. Forget about efficiency I want this in a single query no matter how slow!!! 😀

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Jeff Moden

    SSC Guru

    Points: 994293

    I know it's just a contest and a lot of the problems are made up but I really worry about things like this. Judging from the number of people with performance questions on this site and the folks/problems I run into in real life, there are enough people that don't understand how bad all-in-one queries can be.

    I liked (haven't been there in a while) Phil Factor's "Speed Phreak" challenges a lot better. They allowed folks to use some very effective "Divide-n-Conquer" methods.

    --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.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply