Splitting up and viewing a column using SELECT

  • Hello all,

    Another quick query that Im struggling with.

     

    I have a column that contains 14 characters for example, the column is called sessions and could contains ////####----##

    What I want to do is to split it up and view it as for example

    session1 /

    session2 /

    session3 /

    session4 /

    session5 #

    etc etc. I was going to do a right statement but obviously it will take everything from the right and I want a specific character. Had a look at some of the string

    Any help would be gratefully received.

    Debbie

     

  • how about SubString?

    if you can put exact data from few rows and expected output, i can give a try.

  • Of course

    SELECT SUBSTRING(Sessions, 1, 1)AS s1,

    SUBSTRING(Sessions, 2, 1)AS s2,

    SUBSTRING(Sessions, 3, 1)AS s3,

    SUBSTRING(Sessions, 4, 1)AS s4,

    SUBSTRING(Sessions, 5, 1)AS s5,

    SUBSTRING(Sessions, 6, 1)AS s6,

    SUBSTRING(Sessions, 7, 1)AS s7,

    SUBSTRING(Sessions, 8, 1)AS s8,

    SUBSTRING(Sessions, 9, 1)AS s9,

    SUBSTRING(Sessions, 10, 1)AS s10,

    SUBSTRING(Sessions, 11, 1)AS s11,

    SUBSTRING(Sessions, 12, 1)AS s12,

    SUBSTRING(Sessions, 13, 1)AS s13,

    SUBSTRING(Sessions, 14, 1)AS s14

    FROM Import_Phoenix_SADLAC_FULL

    Thanks for your help

    Debbie

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

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