Array problem

  • I have an ARRAY problem like this:

    I receive a string consisting of sets of 3 values belonging together and I need to convert these values into a relational table. Example:

    'A1,A2,A3,B1,B2,B3,C1,C2,C3'

    Needs to be converted into a table like this:

    C1 C2 C3

    A1 A2 A3

    B1 B2 B3

    C1 C2 C3

    I can convert the string into a single-column table like this:

    Column1

    A1

    A2

    A3

    B1

    B2.....

    To convert this single-column table into a 3 column table, well, I am trying several things involving loops or cursors, but I have not found anything on the Web to do this easily, and I suspect this should be do-able as a SET statement.

    Any hints?

    Greetz,
    Hans Brouwer

  • Have a look at this:

    http://www.sqlservercentral.com/articles/T-SQL/63003/

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Right...

    I knew about this column, did not realize multi-dimensional arrays were included...

    Tnx

    Greetz,
    Hans Brouwer

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

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