Jump to content

Recommended Posts

Posted

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 

Posted

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)

 

 

Posted

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 ...

 

 

Posted

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)

 

 

Posted

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 

×
×
  • Create New...