Coolbaby
Coolbaby

Reputation: 13

SQL Server Convert Decimal

I need to convert the Bacice Salary to decimal values, where I want to give the

SELECT CONVERT(DECIMAL(10,2)

This is my procedure:

ALTER Procedure [dbo].[buson_getEMPLOYEEIDNAME_s]       
(  
    @Month INT,
    @Year INT
)  
As        
Begin        
   SELECT 
      EmpId, Name,
      (BUSON_SALARYSTR.BASICSALARY / dbo.GetNoofDaysPerMonth(@Month, @Year)) *   
 (dbo.GetNoofDaysPerMonth(@Month, @Year) - dbo.NoofdaysAbsent(EmpId,@Month,@Year)) as Basicsalary ,BUSON_SALARYSTR.CODE  
   FROM 
      BUSON_EMP        
   INNER JOIN 
      BUSON_SALARYSTR ON BUSON_SALARYSTR.CODE = BUSON_EMP.SalaryStructure 
      AND BUSON_EMP.EmpId IN (SELECT DISTINCT T1.EmpId 
                              FROM BUSON_ATTENDANCE T0 
                              JOIN BUSON_ATTENCHILD T1 ON T0.DocEntry = T1.DocEntry AND Year(T0.DateofAttendance) = @Year AND MONTH(T0.DateofAttendance) = @Month)     
End

Upvotes: 0

Views: 8998

Answers (1)

praveen
praveen

Reputation: 12271

Just use convert in your select query

Select EmpId,Name,
convert(decimal(10,2),(BUSON_SALARYSTR.BASICSALARY / dbo.GetNoofDaysPerMonth(@Month, @Year)) *   
 (dbo.GetNoofDaysPerMonth(@Month, @Year) - dbo.NoofdaysAbsent(EmpId,@Month,@Year))) 
 as Basicsalary ,... rest of your code 

Upvotes: 4

Related Questions