Convert Column Name and Values as New Row

  • Hi friends,

    I want to do below task from input format to Output format, any help would appreciated.

    INPUT

    pn rvs respamountchargeadjust

    MS0003447 97014A-12.79 30 17.21

    OUTPUT

    pn rvs respamountchargeadjust

    MS0003447 97014A-12.79 30 00.00

    MS0003447 97014 adjust 0.00 0.00 17.21

  • SELECT pn, rvs, resp, amount, charge, adjust = 0.0

    FROM MyTable

    UNION ALL

    SELECT pn, rvs, resp = 'adjust', amount = 0.0, charge = 0.0, adjust

    FROM MyTable

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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