From: visweswaran28 on
Hi,

I am having a table which contains emp_name, basic_pay, PF, other_info.

Now i want to display as,

emp_name1 basic_pay
emp_name1 PF
emp_name1 Other_info

Like this, Instead of displaying in single row, i want to display in
different row based on that emp_name.

How Can I achieve this.

From: Plamen Ratchev on
You can use unpivot assuming columns are the same data type (if not
you have to cast then first in subquery).

SELECT emp_name, col, value
FROM MYTable AS T
UNPIVOT
(value FOR col IN (basic_pay, PF, other_info)) AS U;

--
Plamen Ratchev
http://www.SQLStudio.com