Converting a row to a Column

  • hi, I have a requirement as stated below

    Convert one row in a table to a column:

    Input

    Name

    ID

    Date

    Profile

    Manager

    John

    12

    1/1/1900

    Admin

    12

    Cary

    1

    1/1/1900

    Admin

    12

     

     

    Output

    Name

    John

    Cary

    ID

    12

    1

    Date

    1/1/1900

    1/1/1900

    Profile

    Admin

    Admin

    Manager

    12

    12

     

    I thing i have to use pivot transformation in the data flow but i am not sure how to configure this. Can anyone suggest me how to implemet this or configure this!

     

    Thanks in advance!

  • Have you checked out the thread at http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=176962

    Francis

  • The above thread defines a different senario .... if i am not wrong!!

  • You can use the pivot or unpivot component.

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Crispin,

    The problem is i am not sure what would be the set key and pivot key .... can u please explain little bit more on pivot and unpivot

  • 'I have a requirement...' - What is the requirement? For a report? For data storage? To display on a web page? The example cited from another forum exactly describes how to convert a row, with 'like' information, to a column. Here, you have unlike information that you want to denormalize.

    If you deconstruct and translate the 'business requirements' into plainer language, then you may very well see a better way to meet the requirements (but no guarantee!). At this point, if the solutions offered don't work, then we need a better definition of the problem.

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

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