'Is there a function for multiple column UNPIVOT without a matching WHERE clause in SSMS?
I have a dataset that looks similar to below:
| ID Key | Indicator 1 | Indicator 1 Value | Indicator 2 | Indicator 2 | Indicator 3 | Indicator 3 Value | etc... |
|---|---|---|---|---|---|---|---|
| ID### | Apples | TRUE | Pears | FALSE | Oranges | null | etc... |
| ID### | Oranges | TRUE | Pears | FALSE | APPLES | null | etc... |
| ID### | PEARS | TRUE | APPLES | FALSE | ORANGES | null | etc... |
I've been able to unpivot the indicator names successfully into a single column however my difficulty is matching the indicator Value appropriately to the Indicator Name. Is there a WHERE statement that allows me to grep between the column names to unpivot or a similar operation that can help me sort this? The dataset in question comes from a XML set which may explain the abnormalities.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
