Hi shubhkarve,
Refer below query.
Use CASE statement to select Start and End Date for that specified quarter.
Then use the Start and End date to find total week list.
SQL
DECLARE @FromDate DATETIME = '2022/11/03'
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SELECT
@StartDate =
CASE
WHEN MONTH(@FromDate) BETWEEN 1 AND 3 THEN CONCAT(YEAR(@FromDate) , '/01/01')
WHEN MONTH(@FromDate) BETWEEN 4 AND 6 THEN CONCAT(YEAR(@FromDate) , '/04/01')
WHEN MONTH(@FromDate) BETWEEN 7 AND 9 THEN CONCAT(YEAR(@FromDate) , '/07/01')
WHEN MONTH(@FromDate) BETWEEN 10 AND 12 THEN CONCAT(YEAR(@FromDate) , '/10/01')
END,
@EndDate =
CASE
WHEN MONTH(@FromDate) BETWEEN 1 AND 3 THEN CONCAT(YEAR(@FromDate) , '/03/31')
WHEN MONTH(@FromDate) BETWEEN 4 AND 6 THEN CONCAT(YEAR(@FromDate) , '/06/30')
WHEN MONTH(@FromDate) BETWEEN 7 AND 9 THEN CONCAT(YEAR(@FromDate) , '/09/30')
WHEN MONTH(@FromDate) BETWEEN 10 AND 12 THEN CONCAT(YEAR(@FromDate) , '/12/31')
END
SELECT @StartDate 'StartDate', @EndDate 'EndDate'
Output
StartDate EndDate
2022-10-01 2022-12-31