Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Can't Get Required Output while executing Store Procedure. Any help would be appreciated ?

Can't Get Required Output while executing Store Procedure. Any help would be appreciated ?

Scheduled Pinned Locked Moved Database
comhelpquestioncareer
2 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K K Shah
    wrote on last edited by
    #1

    When i execute the procedure what i get the output is like - ALTER PROC [dbo].[PROC_EMPLOYEE_PAY_SLIP] @EmplopyeeCode varchar(100), @MonthName varchar(50), @Year Float As Begin SELECT ISNULL(HR_EmployeeMaster.em_EmplopyeeCode,'') As EmplopyeeCode, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'A' THEN fa_ComponentMaster.Cm_Name ELSE '' END,'') As Additions, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'D' THEN fa_ComponentMaster.Cm_Name ELSE '' END,'') As Deductions, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'A' THEN Fa_MonthSalary.Ms_Amount ELSE 0 END,0) As AdditionsAmount, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'D' THEN Fa_MonthSalary.Ms_Amount ELSE 0 END,0) As DeductionsAmount FROM HR_EmployeeMaster LEFT JOIN Fa_MonthSalary ON Fa_MonthSalary.ms_EmpCode = @EmplopyeeCode LEFT JOIN Fa_MonthDetails ON Fa_MonthDetails.mo_id = Fa_MonthSalary.Ms_MonCode LEFT JOIN fa_ComponentMaster ON fa_ComponentMaster.cm_code = Fa_MonthSalary.Ms_CompCode WHERE HR_EmployeeMaster.em_EmplopyeeCode = @EmplopyeeCode AND (SELECT CONVERT(CHAR(3), Fa_MonthDetails.mo_name)) = @MonthName AND Fa_MonthDetails.mon_year = @Year End Current Output -

    EmployeeCode Additions Deductions AdditionsAmount DeductionsAmount
    M1010 ALLOWANCE 960.00 0
    M1010 BASIC SALARY 1390.00 0
    M1010 OT1 171.35 0
    M1010 OTHERS-DED 0.00 1800.00

    Required Output -

    EmployeeCode Additions Deductions AdditionsAmount DeductionsAmount
    M1010 ALLOWANCE OTHERS-DED 960.00 1800.00
    M1010 BASIC SALARY 1390.00 0
    M1010 OT1 171.35 0

    Any help would be appreciated :(

    L 1 Reply Last reply
    0
    • K K K Shah

      When i execute the procedure what i get the output is like - ALTER PROC [dbo].[PROC_EMPLOYEE_PAY_SLIP] @EmplopyeeCode varchar(100), @MonthName varchar(50), @Year Float As Begin SELECT ISNULL(HR_EmployeeMaster.em_EmplopyeeCode,'') As EmplopyeeCode, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'A' THEN fa_ComponentMaster.Cm_Name ELSE '' END,'') As Additions, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'D' THEN fa_ComponentMaster.Cm_Name ELSE '' END,'') As Deductions, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'A' THEN Fa_MonthSalary.Ms_Amount ELSE 0 END,0) As AdditionsAmount, ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'D' THEN Fa_MonthSalary.Ms_Amount ELSE 0 END,0) As DeductionsAmount FROM HR_EmployeeMaster LEFT JOIN Fa_MonthSalary ON Fa_MonthSalary.ms_EmpCode = @EmplopyeeCode LEFT JOIN Fa_MonthDetails ON Fa_MonthDetails.mo_id = Fa_MonthSalary.Ms_MonCode LEFT JOIN fa_ComponentMaster ON fa_ComponentMaster.cm_code = Fa_MonthSalary.Ms_CompCode WHERE HR_EmployeeMaster.em_EmplopyeeCode = @EmplopyeeCode AND (SELECT CONVERT(CHAR(3), Fa_MonthDetails.mo_name)) = @MonthName AND Fa_MonthDetails.mon_year = @Year End Current Output -

      EmployeeCode Additions Deductions AdditionsAmount DeductionsAmount
      M1010 ALLOWANCE 960.00 0
      M1010 BASIC SALARY 1390.00 0
      M1010 OT1 171.35 0
      M1010 OTHERS-DED 0.00 1800.00

      Required Output -

      EmployeeCode Additions Deductions AdditionsAmount DeductionsAmount
      M1010 ALLOWANCE OTHERS-DED 960.00 1800.00
      M1010 BASIC SALARY 1390.00 0
      M1010 OT1 171.35 0

      Any help would be appreciated :(

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You already posted this question in QA at Can't get required output while executing procedure[^]. Please do not crosspost.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups