Hello Guys this ways to
insert the data in
PYRLL_TDS_Employee_HouseRentDetails
table.
how to update the mulitple value of monthID and amount details.
plz help
DECLARE @YearName varchar(50);
SELECT
@YearName = Name
FROM
PYRLL_SYSTM_CalendarYear_Master
WHERE
PK_CalendarYear_Master_Id = @p_CalendarYearId
And
IsActive = 1
;
WITH cteValues (MonthId, Amount) As
(
SELECT 1, @p_HouseRentAmountJan
UNION ALL SELECT 2, @p_HouseRentAmountFeb
UNION ALL SELECT 3, @p_HouseRentAmountMar
UNION ALL SELECT 4, @p_HouseRentAmountApr
UNION ALL SELECT 5, @p_HouseRentAmountMay
UNION ALL SELECT 6, @p_HouseRentAmountJun
UNION ALL SELECT 7, @p_HouseRentAmountJul
UNION ALL SELECT 8, @p_HouseRentAmountAug
UNION ALL SELECT 9, @p_HouseRentAmountSep
UNION ALL SELECT 10, @p_HouseRentAmountOct
UNION ALL SELECT 11, @p_HouseRentAmountNov
UNION ALL SELECT 12, @p_HouseRentAmountDec
)
INSERT INTO PYRLL_TDS_Employee_HouseRentDetails
(
FK_Employee_Id,
FK_Calendar_Month_Id,
FK_CalendarYear_Master_Id,
Year,
HouseRentAmount,
CreatedBy,
CreatedOn,
CreatedOnUTC,
Disabled
)
SELECT
@p_EmployeeId,
MonthId,
@p_CalendarYearId,
@YearName,
Amount,
@p_CreatedBy,
GetDate(),
GetUtcDate(),
0
FROM
cteValues
;