Eswar Datta

Eswar Datta

  • NA
  • 115
  • 7.3k

Stored procedure

Aug 14 2018 5:23 AM
I created procedure to retrieve data with based on ID but i retrirves duplicate rows.
 
CREATE PROCEDURE ATS_PROFILE_GET(@EMP_ID NVARCHAR(MAX))
AS BEGIN
SELECT EMP.EMP_NAME,EMP.EMP_EMAIL_ID,EMP.EMP_CONT_NO,EMP.EMP_DESG,EMP.EMP_DEPARTMENT,EMP.DOJ,EMP.POSITION,EMP.AVAILABLE_LEAVES,
EMP_PERSONAL.EMP_GENDER,EMP_PERSONAL.EMP_MARITAL,EMP_PERSONAL.EMP_MOBILENUMBER,EMP_PERSONAL.EMP_EMAILID,EMP_PERSONAL.EMP_TEMP_CITY,
EMP_PERSONAL.EMP_TEMP_COUNTRY,EMP_PERSONAL.EMP_TEMP_STATE,EMP_PERSONAL.EMP_TEMP_MANDAL,EMP_PERSONAL.EMP_TEMP_PINCODE,EMP_PERSONAL.EMP_PER_COUNTRY,EMP_PERSONAL.EMP_PER_STATE,
EMP_PERSONAL.EMP_PER_CITY,EMP_PERSONAL.EMP_PER_MANDAL,EMP_PERSONAL.EMP_PER_PINCODE,EMP_EDU.EMP_BOARDorUNIVERSITY,EMP_EDU.EMP_COURSE,EMP_EDU.EMP_PASSEDOUTYEAR,
EMP_EDU.EMP_SPECALISATION,EMP_NOM.EMP_NAME,EMP_NOM.EMP_RELATION,EMP_NOM.EMP_PHONENUMBER,EMP_NOM.EMP_AGE,EMP_NOM.EMP_ADDRESS,EMP_PROF.EMP_COMPANYNAME,EMP_PROF.EMP_EXPERIENCE,
EMP_PROF.EMP_INDUSTRY,EMP_PROF.EMP_FUNCTIONALAREA,EMP_PROF.EMP_EMPLOYMENTTYPE,EMP_PROF.EMP_DESIGNATION,EMP_PROF.EMP_WORKINGLOCATION,EMP_PROF.EMP_PAYSLIP
FROM EMPLOYEE AS EMP JOIN
EMPLOYEE_PERSONAL_DETAILS AS EMP_PERSONAL ON EMP.EMP_REG_ID=EMP_PERSONAL.EMP_REG_ID JOIN EMPLOYEE_EDUCATION_DETAILS AS EMP_EDU ON EMP_EDU.EMP_REG_ID=EMP_PERSONAL.EMP_REG_ID
JOIN EMPLOYEE_NOMINEE_DETAILS AS EMP_NOM ON EMP_NOM.EMP_REG_ID=EMP_PERSONAL.EMP_REG_ID JOIN EMPLOYEE_PROFESSIONAL_DETAILS AS EMP_PROF ON
EMP_PROF.EMP_REG_ID=EMP_PERSONAL.EMP_REG_ID WHERE EMP_ID=@EMP_ID END
 
 
ATS_PROFILE_GET 'SNPL-4001' 
 
WHEN execute that procedure it retrieve 27 records with same data. 
 
 

Answers (2)