Solved

When can I use PIVOT and when should I use UNPIVOT?I

Posted on 2014-01-23
1
227 Views
Last Modified: 2014-01-24
Can anyone please tell me when I should be using PIVOT and when I should be using UNPIVOT?
0
Comment
Question by:RajG1978
1 Comment
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39805545
If you receive a normalized table, you can use PIVOT (scroll down for some examples) to change it so that it is pivoted, i.e. rows-columns-value, like an Excel spreadsheet.

If you receive PIVOTED data, and wish to normalize it, that would be an UNPIVOT.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to shrink a transaction log file down to a reasonable size.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question