How to unpivot result in query? <p>I am using MS SQL 2005.</p> <p>This is the query:</p> <pre><code>SELECT allow_r, allow_h, allow_c, sponsorid FROM Sponsor WHERE sponsorid = 2 </code></pre> <p>This is the result:</p> <pre><code>allow_r allow_h allow_c sponsorid ---------- ---------- ---------- ----------- 1 1 0 2 </code></pre> <p>I need it to be:</p> <pre><code>allow_r 1 2 allow_h 1 2 </code></pre> <p>allow_c should not be in the result as its 0</p>