stored procedure code to implement the following scenario.
I have two tables (Stage. PP_Projects (Source table) ,DBO.PP_Projects (Target table) ) and need to implement the following scenario in a stored procedure. For Populating the FY Columns we need to be using the Period_NUM, Period_Year, DNLD_DATE from the Stage. PP_Projects. 1. FY_Period_Year is the direct mapping from the Period_year column in the stage.PP_Projects 2. FY_Period_NAME is also the Direct Mapping for the from the Period_NAME column in the stage.PP_Projects 3. FY_Period_START_DATE is the Start date of the Period which should be populated based on the DNLD_DATE. 4. FY_Period_END_DATE is the END Date of the period which needs to be calculated based on the next DNLD_DATE, which is the day before the next DNLD_DATE. 5. FY_QUARTER_NUMBER is based on the Period_NUM. IF the Period_NUM is 1 to 3 then 1, if the period_num is 4 to 6 then 2 , if period_num is 7 to 9 the 3 , if period_num greater than 9 then 4. 6. FY_QUARTER is also based on the Period_NUM. IF the Period_NUM is 1 to 3 then Q1, if the period_num is 4 to 6 then Q2 , if period_num is 7 to 9 the Q3 , if period_num greater than 9 then Q4. Can you please help me to solve this