Click here to Skip to main content
15,039,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
SQL
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
;
Posted
v3
Comments
CHill60 23-Dec-15 3:52am
   
It's not entirely clear what your problem is - can you explain further

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900