Home Forums SQL Server 2005 Development How to show the column wise data into row wise RE: How to show the column wise data into row wise

  • Please try to do following steps:

    Copy the date you want

    Paste Special in the sheet where you want

    Please refer to the following picture:

    Select my_Row1=max(isnull(case when rn=1 then mob_no end,'')),

    my_Row2=max(isnull(case when rn=2 then mob_no end,'')),

    my_Row3=max(isnull(case when rn=3 then mob_no end,'')),

    my_Row4=max(isnull(case when rn=4 then mob_no end,'')),

    my_Row5=max(isnull(case when rn=5 then mob_no end,'')) from (

    Select top 5 RN=ROW_NUMBER () OVER (order by mob_no),mob_no from myDB..my_TABLE a with (nolock))j