Mutlipe row concatenation

  • There is no optimized way to do pivoting in Transact SQL - if you want it to be as optimal as possible, this should be done at the client. SQL isn't 'suitable' for this kind of operations.

    There are a few ways to do it anyway, though none that is pretty or especially performance friendly (ie the cursor way).

    /Kenneth

  • Thanks Kenneth,

     

    As the above process being part of ETL program, there is no way to utilise this in the client side. Anywat thanks for u'r info.

    regards

    saravan

  • Hi,

    You can try this solution

    Declare @longStr varchar(5000)

    Set @longStr=''

    Select @longStr=@longStr + col1+'~'+col1+'~'+col2+'~'+...+colN+'$'

    From Orders

    But this string may get truncated if your rowsize increases.

    -Hari

     

     

     


    Kindest Regards,

    Hari

Viewing 3 posts - 1 through 4 (of 4 total)

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