ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 275.3k

How to replace OR statment on revision by another best practise and mo

Feb 9 2021 9:00 PM
How to replace OR statment on revision by another best practise and more performance ?

I work on SQL server 2012 I face issue I need to use any thing alternative or best from using OR statement multiple time .

so How to use any solution without Using OR statement on Revision

with another meaning I need to replace that by any thing best practise and more performance

  1. isnull(f.Revision_ID,'')=isnull(m.Revision_Id,'')   
  2.                      OR  isnull(f.revision_id,'') = isnull(m.ReflowTemperatureSource_Revision_Id,'')  
  3.                      OR     isnull(f.revision_id,'') = isnull(m.[MSLSource_Revision_id],'')  
  4.                      OR     isnull(f.revision_id,'') = isnull(m.Revision_Id,'')  
  5.                      OR     isnull(f.revision_id,'') = isnull(m.[ShelfLifeRevisionID],'')  
  6.                      OR     isnull(f.revision_id,'') = isnull(m.[BaseMaterialRevisionID],'')    
  7.                      OR     isnull(f.revision_id,'') = isnull(m.[WaveTemperatureSource_Revision_ID],'')  
  8.     
  9.  SELECT TOP 1000000   
  10.          p.PartNumber PartNumber ,  
  11.                  c.CompanyName CompanyName ,      
  12.                  reflowv.online_url ReflowTemperatureSourceOnline ,  
  13.                  reflowv.local_url ReflowTemperatureSourceOffline ,      
  14.          m.Comment  
  15.  
  16.          FROM    #TempPC t  
  17.          inner join #final f on t.RevisionID=f.Revision_Id  
  18.               
  19.                  LEFT JOIN Parts.ManufacturingData m WITH(NOLOCK) ON isnull(f.Revision_ID,'')=isnull(m.Revision_Id,'')   
  20.                  OR  isnull(f.revision_id,'') = isnull(m.ReflowTemperatureSource_Revision_Id,'')  
  21.                  OR     isnull(f.revision_id,'') = isnull(m.[MSLSource_Revision_id],'')  
  22.                  OR     isnull(f.revision_id,'') = isnull(m.Revision_Id,'')  
  23.                  OR     isnull(f.revision_id,'') = isnull(m.[ShelfLifeRevisionID],'')  
  24.                  OR     isnull(f.revision_id,'') = isnull(m.[BaseMaterialRevisionID],'')    
  25.                  OR     isnull(f.revision_id,'') = isnull(m.[WaveTemperatureSource_Revision_ID],'')  
  26.                      LEFT JOIN [Z2URLSystem].[zsrc].[core_view] reflowv WITH(NOLOCK) ON isnull(reflowv.revision_id,'') = isnull(m.ReflowTemperatureSource_Revision_Id,'')  
  27.       
  28.                  LEFT JOIN Parts.Nop_Part p  WITH(NOLOCK) ON p.partid=m.partid  
  29.                  LEFT JOIN #Values va ON va.partid = p.PartID