split single row into multiple lines

  • Hi,

    Can any one help me please

    How to split single row into multiple lines (Not rows)

    Thanks

    Grace

  • Not sure what you mean by this, can you please provide examples

  • You could use CHAR(10) or CHAR(13) (depending on the output).

    Could you give an example on what you're trying to do? or explain more the reason to have several lines?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • For Exp: I have the row data lengthy like "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

    I need to display that data in Card in Power View, I able display as it is

    but I need like aaaaaaaaaaaaaaaaa

    aaaaaaaaaaaaaaaaaaaa

    aaaaaaaaaaaaaaaaaaaaaaa

    aaaaaaaaaaaaaaaaaaaaaaa

    Doesn't matter after how many char it will split, Just I need to split row data into multiple lines.

    Thanks

    Grace

  • For Exp: I have the row data lengthy like "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

    I need to display that data in Card in Power View, I able display as it is

    but I need like aaaaaaaaaaaaaaaaa

    aaaaaaaaaaaaaaaaaaaa

    aaaaaaaaaaaaaaaaaaaaaaa

    aaaaaaaaaaaaaaaaaaaaaaa

    Doesn't matter after how many char it will split, Just I need to split row data into multiple lines.

    Thanks

    Grace

  • Something like this?

    WITH Sample_Data AS(SELECT 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' string)

    SELECT SUBSTRING( string, 1, 10) + CHAR( 10) +

    SUBSTRING( string, 11, 10) + CHAR( 10) +

    SUBSTRING( string, 21, 10) + CHAR( 10) +

    SUBSTRING( string, 31, 10) + CHAR( 10) +

    SUBSTRING( string, 41, 10) + CHAR( 10) +

    SUBSTRING( string, 51, 10) + CHAR( 10) +

    SUBSTRING( string, 61, 10) + CHAR( 10) +

    SUBSTRING( string, 71, 10) + CHAR( 10) +

    SUBSTRING( string, 81, 10) + CHAR( 10) AS multiple_lines

    FROM Sample_Data

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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