mercredi 23 décembre 2015

Get total_days value in a parameter from the table

I have a table in which I have a column name as total_days, this column contains the number of days the employee has taken leave

What I want is, I want to take the above column in a parameter say @NoOfDaysForDelayApproval.

What I tried is

declare @NoOfDaysForDelayApproval int
                    BEGIN
                        select @NoOfDaysForDelayApproval = sum(Total_Days) 
                            from XXACL_EMP_DELAY_APPROVAL_V    
                            where cardno=@EmpCardNo
                            and DMonth= @Month
                            and DYear = @Year
                    END

but I am unable to get the exact value for an employee. Is there any other simple way to get that value in a parameter ?

I am using SQL server 2005

Aucun commentaire:

Enregistrer un commentaire