简体   繁体   中英

Automatic date in pivot in stored procedure

As I am less aware of Stored Procedure can anyone help me out with automatic date in pivot as I want the user to select start date and end date and I want to display all the selected dates as horizontally. As till now I am using dynamic dates by writing dates in pivot but I want it to display all the dates from the start date to the end date automatically.

Can anyone help me?

As it should display date as 01,02,03,04,05 up to the end date

In SQL Server you cannot. The column names are part of the query. Dynamic is the way to go, but be careful - dynamic results from SPs are difficult to consume. You might want to rethink and go traditional row-based doing the pivot in your front end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM