troubleshooting Question

How to create a pivot table in SQL SERVER with a Dynamic Date Range passed into it that builds columns

Avatar of RUA Volunteer2?
RUA Volunteer2?Flag for United States of America asked on
SQLMicrosoft SQL Server
1 Comment1 Solution15 ViewsLast Modified:
I have a SQL query that I cannot post so I am looking for an example or direction if you can help please. We have a dataset / datasource that has month over month to year over year data. We need to be able to allow a user to pick a date range and the SQL build a Pivot Table that dynamically builds the Pivot table based on their selection. I heard rumor that this might be possible with a variable driven by parameters? Can any one describe demonstrate point to video/illustrate or have all 3 pieces of information that might help me accomplish this.

So the user picks a date range say 6/1/2019 to 6/1/2021
The SQL Pivot builds a series of columns that show the data related to the dates below.
Jun-19, Jul-19, Aug-19, ....... Jun-20, Jul-20, Aug-20, ....... Apr-21, May-21, Jun-21

Is this even possible. If not please let me know. Thank you. 
ASKER CERTIFIED SOLUTION
lcohan
Database Analyst
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 1 Comment.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 1 Comment.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004