Dwarkesh Vajjala

Dwarkesh Vajjala

  • 682
  • 1.4k
  • 60.6k

Generate Dynamic Date Columns as per input.

Jun 18 2024 9:41 AM
DECLARE @StartDate DATE = '2024-01-01';
DECLARE @EndDate DATE = '2024-01-07';


-- like a temprary table must be create with columns as.

-- thes start date and end date is dynamic. so it can go 7 columns , 12 columns , 70 columns..etc

_____________________________________________________________________________________________
id |2023/01/01 | 2023/01/02 | 2023/01/03 | 2023/01/04 | 2023/01/05 | 2023/01/06 | 2023/01/07 |
---------------------------------------------------------------------------------------------



so i want dynamic generated columns  for the temporary table. where the StartDate and EndDate are dynamic example 7,14,90 days.

 


Answers (1)