How to get top 100 values of a col concatenated in a variable in sqlserver?

  • we do  not want to use xml. so pls tell me with out it?

  • rajemessage 14195 wrote:

    we do  not want to use xml. so pls tell me with out it?

    At least read the latest posts. 🙁  Kaj wrote a solution for you and I tweaked it to solve an issue in it and it does exactly what you specified without XML.

    And it would be really nice if you shared the reason why you need to do this so that we understand the reason for the request to more easily help others in the future.

    As for you folks not wanting to use XML for this, let me throw what you said back at ya...

    rajemessage 14195 wrote:

    I agree with your point, but it is needed sometimes...

    To wit, you have doomed this code to being RBAR forever.  Please don't complain about the performance in the future because you already know the fix from this thread... use the XML method.

    😉

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

  • rajemessage 14195 wrote:

    we do  not want to use xml. so pls tell me with out it?

    whoever decides they do not wish to use the XML PATH functionality should be fired - or pay for the upgrade cost to a newer version of SQL Server where you can use the new functionality.

    the function does NOT create a XML string - so any objections to use XML are moot and just show a huge lack of knowledge of what the function does.

  • @rajemessage 14195 ,

    Enquiring minds want to know... did the non-XML method work for you?😋

     

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

Viewing 4 posts - 16 through 18 (of 18 total)

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