Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Who can i convert row values into columns in SQL server?

user-image
Question added by Noor Ali Chagani , Software Development Manager , The Punjab Healthcare Commission (PHC)
Date Posted: 2014/05/26
Adeel Nayyer Sheikh
by Adeel Nayyer Sheikh , Application Developer (SharePoint Development) , NewBoy FZCO

There are multiple ways to transform rows into columns in SQL. One of those ways is to use PIVOT in SQL like the example below.

 

select col1, col2, col3

from

(

  select value, columnname

  from yourtable

) d

pivot

(

  max(value)

  for columnname in (col1, col2, col3)

) piv;

SURESH ALATHADY MALOOR
by SURESH ALATHADY MALOOR , Software Engineer - II

USE PIVOT

Ganesh Sampat Abdagire
by Ganesh Sampat Abdagire , Senior .NET Developer , Qatar Islamic Bank

Yes it is possible by using PIVOT keyword in sql

Hi,

Please visit the following URL you can fnd the answer here . hop this will help.

http://blog.jontav.com/post//convert-rows-to-columns-columns-to-rows-in-sql-server

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.