Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7664681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:21:59+00:00 2026-05-31T14:21:59+00:00

I need to create a report using SQL Server 2008R2 Stored procedure that will

  • 0

I need to create a report using SQL Server 2008R2 Stored procedure that will return the following shape of data:
enter image description here

My view in SQL Server is returning data like this:
enter image description here

The user will select start_date and end_date and that date range will be displayed in columns, i.e. if user selects Apr 1,2012 to Apr 7, 2012 then 7 days, Day1 to Day7 will be shown in columns. The left column will show the totals of “ApplicationId” field.
Note that “Assigned”, “Processing”,.. are Status field.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:22:00+00:00Added an answer on May 31, 2026 at 2:22 pm

    Check this example.. as like i have implemented using this one. you can create your dynamic columns/ dynamic pivot. but you have to it using execute in sql server.

    You can implement/ modify your query as you want.

    Ref: Pivots with Dynamic Columns in SQL Server 2005

    DECLARE @query NVARCHAR(4000) SET @query = N'SELECT tID, '+ @cols +' FROM (SELECT  t2.tID
          , t1.ColName
          , t2.Txt FROM    Table1 AS t1
            JOIN Table2 AS t2 ON t1.ColId = t2.ColID) p PIVOT ( MAX([Txt]) FOR ColName IN ( '+ @cols +' ) ) AS pvt ORDER BY tID;'
    
    Executing this with
    
    EXECUTE(@query)
    

    For more reference about this:
    SQL Server – Dynamic PIVOT Table – SQL Injection
    Dynamic PIVOT Query For Cross Tab Result
    Dynamic Pivoting in SQL Server – it contains some example that somewhat match your requirement..

    Hope this help..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using iReport and I need to create a sub-report using a XML DataSource
I need to create a repeatable process for deploying SQL Server Reporting Services reports.
I need to find/create an application that will create employee web usage reports from
I need to create a PDF Report using iTextSharp. I have an excel sample,which
I need to parse Visual Studio automatically generated XML documentation to create a report.
I can't create a NT account for everyone that need access to the reports.
We are developing a web application using asp.net and sql server. We are required
BACKGROUND I'm writing a method that will (eventually) take as input a System.Data.DataTable and
I am using MembershipServices. I have some other tables that I need to associate
I am building a report for my application using VS2010. The data for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.