• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Convert column data into rows

I have a generic list with 10 columns. I am interested in converting the following four columns into two columns.
one called Product and the other column holding the Id number of the product.
and keep the rest of the six columns as is

ProductA 2345
ProductB 3456
ProductC 6789
productD 9876

I want to convert this into two columns
Product       ID
ProductA  2345
ProductB       3456
ProductC       6789
productD       9876


The end result in this case would result in four rows for every single row.
0
countrymeister
Asked:
countrymeister
  • 2
1 Solution
 
käµfm³d 👽Commented:
Please post an example of the data as it exists in your environment. You mentioned, "...keep the rest of the six columns as is." Where are the other six columns in your example?
0
 
countrymeisterAuthor Commented:
List<T>

T contains the following properties

ID
Region
Description
Price
Volume
Comments
ProductA
ProductB
ProductC
ProductD
0
 
countrymeisterAuthor Commented:
Please close this question as I found my solution via sql using UNPIVOT
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now