sri_sql Posted March 25, 2014 Author Report Posted March 25, 2014 I am getting confused on the OR condition of urs man... can you tell me what is the exact scenario there... what condition to check and load if not present???? Original Cursor lo CaseID = @CaseID ani petukoni if that satisfies or if CaseID of the table is null and Account Number and CaseNumber condition ga tiskunadu Nenu adi naa temp table lo column ki pettanu like if exists(Select distinct from Targettable left inner join #temp on target.CaseID = temp.CaseID additional ga or condition ichanu
loveindia Posted March 25, 2014 Report Posted March 25, 2014 do this man.... change ur if exists into two steps... IF EXISTS( SELECT 1 FROM ECaR.tblBKYBankruptcy_Test TBLB INNER JOIN #BKYTVL TVL ON TBLB.CaseID = TVL.CaseID ) IF EXISTS( SELECT 1 FROM ECaR.tblBKYBankruptcy_Test TBLB LEFT OUTER JOIN #BKYTVL TVL ON TBLB.AccountNumber = TVL.AccountNumber AND ISNULL(TBLB.CaseNumber,TVL.CaseNumber) = TVL.CaseNumber AND TBLB.CaseID IS NULL)
sri_sql Posted March 25, 2014 Author Report Posted March 25, 2014 do this man.... change ur if exists into two steps... IF EXISTS( SELECT 1 FROM ECaR.tblBKYBankruptcy_Test TBLB INNER JOIN #BKYTVL TVL ON TBLB.CaseID = TVL.CaseID ) IF EXISTS( SELECT 1 FROM ECaR.tblBKYBankruptcy_Test TBLB LEFT OUTER JOIN #BKYTVL TVL ON TBLB.AccountNumber = TVL.AccountNumber AND ISNULL(TBLB.CaseNumber,TVL.CaseNumber) = TVL.CaseNumber AND TBLB.CaseID IS NULL) Ya..I will try this bhayya ...
loveindia Posted March 25, 2014 Report Posted March 25, 2014 Original Cursor lo CaseID = @CaseID ani petukoni if that satisfies or if CaseID of the table is null and Account Number and CaseNumber condition ga tiskunadu Nenu adi naa temp table lo column ki pettanu like if exists(Select distinct from Targettable left inner join #temp on target.CaseID = temp.CaseID additional ga or condition ichanu which of these is correct (caseid = @caseid or caseid ISNULL) and accountnumber and casenumber or caseid = @caseid OR (caseid is null and account number and casenumber)
sri_sql Posted March 25, 2014 Author Report Posted March 25, 2014 which of these is correct (caseid = @caseid or caseid ISNULL) and accountnumber and casenumber or caseid = @caseid OR (caseid is null and account number and casenumber) CaseId = @CaseID OR (CaseID IS NULL AND AccountNumber and CaseNumber) is the right one
Recommended Posts