STRING_SPLIT()

  • Comments posted to this topic are about the item STRING_SPLIT()

  • Steve Jones - SSC Editor - Saturday, July 7, 2018 11:21 AM

    Comments posted to this topic are about the item STRING_SPLIT()

    I don't know what went wrong.  I clicked on the correct answer and it said I was wrong and it cited one of the other answers in the explanation.

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

  • The alleged "correct" answer is wrong.
    😎

    What version of SQL Server did you test this on Steve? Looks to me that there must be an implicit type conversion on the delimiter parameter.

  • Eirikur Eiriksson - Sunday, July 8, 2018 12:45 AM

    The alleged "correct" answer is wrong.
    😎

    What version of SQL Server did you test this on Steve? Looks to me that there must be an implicit type conversion on the delimiter parameter.

    Lordy... I have to answer these things when I'm sufficiently caffeinated.  I didn't read what the post thought was the correct answer, which is patently incorrect thanks to the space in the delimiter and, yes, I did click the correct answer... not what the post thinks the correct answer is.

    I don't care about the points (never did) but, as Eirikur states, the alleged correct answer isn't correct and needs to be repaired.

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

  • Jeff Moden - Sunday, July 8, 2018 7:27 AM

    Eirikur Eiriksson - Sunday, July 8, 2018 12:45 AM

    The alleged "correct" answer is wrong.
    😎

    What version of SQL Server did you test this on Steve? Looks to me that there must be an implicit type conversion on the delimiter parameter.

    Lordy... I have to answer these things when I'm sufficiently caffeinated.  I didn't read what the post thought was the correct answer, which is patently incorrect thanks to the space in the delimiter and, yes, I did click the correct answer... not what the post thinks the correct answer is.

    I don't care about the points (never did) but, as Eirikur states, the alleged correct answer isn't correct and needs to be repaired.

    I use this to get properly caffeinated before responding to anything in the morning
    😎
    DeLonghi Dedica Espresso and Cappuccino Machine

    Takes about 3-4 single espressos in about half an hour but then nothing can put one to sleep for the next 18-20 hours 😀

    Just as Jeff said, this is not about any points, it's all about retaining the good quality of advice provided by the SSC community and this website.

  • and here i thought - am i losing my marbles?
    the space after the coma in the delimiter will surely cause an error...
    glad i'm not the only one who thinks the "correct" answer is actually incorrect...

  • Didn't have any coffee yet, but selected the right (wrong) answer..

  • DECLARE @cars VARCHAR(200) = 'Porsche, Ferrari, Bentley, Jaguar,Range Rover'
    SELECT *
    FROM STRING_SPLIT(@cars, ', ') 
    please, remove last blank from separator

  • Right answer is an error. Problem is the space after the comma in the function. I want my point back! 🙂

  • Yep - at least everyone else saw the same thing I saw.  Incorrect answer marked as correct.

  • Too early on a Monday for this.

  • I can not run the code, the article "Splitting Strings in SQL Server 2016" explains this differently.

  • Yeah, yeah.  The correct answer is "wrong".

    But more importantly, what is it that you don't want to do, Steve?

  • When I executed this code in SQL Server 2016, below is the error:

    Procedure expects parameter 'separator' of type 'nchar(1)/nvarchar(1)'

    Thank You.

    Regards,
    Raghavender Chavva

Viewing 15 posts - 1 through 15 (of 23 total)

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