ALTER PROCEDURE [dbo].[sp_CSP_GetEMIloanDetails] @ID int, @Customer_Type TinyInt AS BEGIN DECLARE @Member_Id INT = 0 DECLARE @Valid_Acc INT = 0 IF @Customer_Type = 1 BEGIN SET @Member_Id = (SELECT Member_Id FROM GLNo_Registration WHERE ID = @ID AND Is_Active = 1) IF @Member_Id = 0 OR @Member_ID IS NULL BEGIN SELECT 'Invalid ID' AS Valid_Msg RETURN END END ELSE BEGIN SET @Member_Id = (SELECT ID FROM Member WHERE ID = @ID AND Is_Active = 1) IF @Member_Id = 0 OR @Member_ID IS NULL BEGIN SELECT 'Invalid ID' AS Valid_Msg RETURN END END SET @Valid_Acc =(SELECT COUNT(A.Account_No) FROM Account A,Member M WHERE A.Member_Id=M.ID AND M.ID=@Member_Id) IF @Valid_Acc IS NULL BEGIN SELECT M.First_Name AS Name, M.DOB, M.Occupation, (case when m.TDS=1 then m.TDS_RefNo end) as Pan_Number, (SELECT A.Account_No FROM Account A WHERE A.Member_Id=M.ID)AS Account_No FROM Member M,Account A WHERE A.Member_Id =M.ID AND M.ID=@Member_Id END ELSE BEGIN SELECT M.First_Name AS Name,M.ID, M.DOB, M.Occupation, (case when m.TDS=1 then m.TDS_RefNo end) as Pan_Number, A.Account_No FROM Member M JOIN Account A ON A.Member_Id =M.ID AND M.ID=@Member_Id END END
SELECT M.First_Name AS Name,M.ID, M.DOB, M.Occupation, (case when m.TDS=1 then m.TDS_RefNo end) as Pan_Number, A.Account_No FROM Member M LEFT JOIN Account A ON A.Member_Id =M.ID AND M.ID=@Member_Id
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)