Tally OH! An Improved SQL 8K “CSV Splitter” Function

  • Jeff Moden

    SSC Guru

    Points: 996490

    Eirikur Eiriksson - Tuesday, March 19, 2019 7:18 AM

    Quick question, are there any multi-line entries or can one use the new line bytes as a row delimiter?
    😎

    To whom are you directing that question?

    --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)
    Forum FAQ

  • Eirikur Eiriksson

    SSC Guru

    Points: 182430

    Jeff Moden - Tuesday, March 19, 2019 7:26 AM

    Eirikur Eiriksson - Tuesday, March 19, 2019 7:18 AM

    Quick question, are there any multi-line entries or can one use the new line bytes as a row delimiter?
    😎

    To whom are you directing that question?

    The OP
    😎

    The spanner in the works is the multi row entries, big difference from handling single row entries 😉

  • Jeff Moden

    SSC Guru

    Points: 996490

    Eirikur Eiriksson - Tuesday, March 19, 2019 8:52 AM

    Jeff Moden - Tuesday, March 19, 2019 7:26 AM

    Eirikur Eiriksson - Tuesday, March 19, 2019 7:18 AM

    Quick question, are there any multi-line entries or can one use the new line bytes as a row delimiter?
    😎

    To whom are you directing that question?

    The OP
    😎

    The spanner in the works is the multi row entries, big difference from handling single row entries 😉

    Agreed but not much of one if each "record" has the same pattern of multi-line entries.  I do use format files for such a thing if the multi-line entries are consistent.

    --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)
    Forum FAQ

  • corey lawson

    Hall of Fame

    Points: 3726

    Hey, Jeff, will you update this yet again to include the new split_string() function in SQL Server 2016+?

     

  • Jeff Moden

    SSC Guru

    Points: 996490

    corey lawson wrote:

    Hey, Jeff, will you update this yet again to include the new split_string() function in SQL Server 2016+?

    Probably not. The STRING_SPLIT function is relatively crippled for those that need to know the position of the split out elements.  That's been pretty well covered by Wayne Sheffield when it first came out.  Here's the link...

    https://www.sqlservercentral.com/articles/splitting-strings-in-sql-server-2016

    --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)
    Forum FAQ

Viewing 5 posts - 946 through 950 (of 950 total)

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