title: Finding Not null on multiple columns using COALESCE
body: <p>I have a query to find not null on 2 columns on a table which is a view , hence it is taking a lot of time for execution.
  The query is : Query1</p>
  
  <pre><code>SELECT [Table1].M, [[Table1]].B, [Table1].P
  FROM [Table1]
  WHERE ((([[Table1]].B) Is Not Null) AND (([[Table1]].P) Is Not Null));
  </code></pre>
  
  <p>Does the below query does the same function as Query1 with faster execution time ?</p>
  
  <pre><code>SELECT [Table1].M, [[Table1]].B, [Table1].P
  FROM [Table1]
  WHERE COALESCE (([[Table1]].B),([[Table1]].P)) Is Not Null
  </code></pre>
  
  <p>Any help would be of great help and thanks in advance.</p>
  
  <p>The view query</p>
  
  <pre><code>select dbo.TABLE1.[COL1]
      , dbo.TABLE1.[COL2]
      , RIGHT(dbo.TABLE1.M, 12) as M
      , dbo.TABLE2.[MD]
      , dbo.TABLE1.[COL3]
      , dbo.TABLE1.[COL4]
      , dbo.TABLE3.COL1
      , dbo.TABLE3.[COL2]
      , dbo.TABLE3.[COL3]
      , dbo.TABLE4.[COL1]
      , dbo.TABLE5.[COL1]
      , dbo.TABLE6.[COL1]
      , dbo.TABLE7.[COL1] as [BA]
      , dbo.TABLE8.[COL1]
      , dbo.TABLE3.[COL4]
      , dbo.TABLE3.[COL5]
      , dbo.TABLE3.[COL6]
  from dbo.TABLE1
  left outer join dbo.TABLE2
      on dbo.TABLE1.M = dbo.TABLE2.M
  left outer join dbo.TABLE3
      on dbo.TABLE1.M = dbo.TABLE3.M
  left outer join dbo.TABLE5
      on dbo.TABLE3.[OBJ_NR] = dbo.TABLE5.OBJ
  left outer join dbo.TABLE6
      on dbo.TABLE3.[OBJ_NR] = dbo.TABLE6.OBJ
  left outer join dbo.TABLE7
      on dbo.TABLE3.[OBJ_NR] = dbo.TABLE7.OBJ
  left outer join dbo.TABLE4
      on dbo.TABLE3.[OBJ_NR] = dbo.TABLE4.OBJ
  left outer join dbo.TABLE8
      on dbo.TABLE3.[OBJ_NR] = dbo.TABLE8.OBJ
  where (
          (
              dbo.TABLE1.[COL1] not in (
                  'XX'
                  , 'YY'
                  )
              )
          and (dbo.TABLE1.COL5 = 'x')
          )
  </code></pre>