Skip to main content

Dynamic Pivot and Unpivot

  • Chapter
  • First Online:
Dynamic SQL
  • 1394 Accesses

Abstract

PIVOT is an extremely efficient way to alter the structure of a result set, expanding a single column of values into a set of separate columns. UNPIVOT does the exact opposite, taking a set of columns and resolving them into a single output column. Both of these operators can be very useful in reporting, analytics, or when trying to format existing data into a specific structure as required by an application.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 64.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Edward Pollack

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Pollack, E. (2019). Dynamic Pivot and Unpivot. In: Dynamic SQL. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4318-3_9

Download citation

Publish with us

Policies and ethics