title: SQL Server : IF condition within where clause
body: <p>I am trying to put an if condition within a where clause and I cannot figure out the correct syntax for what I want. </p>
  
  <p>The logic should be if a certain period is equal to a specific number then check to make sure pdftype is not null else then don't check it all. </p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>where  
      g.ReportInstanceID = blah
      and rcr.FormID = blah
      and rcr.FormSectionID = blah
      and rcr.SubSectionID = blah
      and CASE rcr.DataCollectionPeriodID 
             WHEN 163 THEN (PDFType IS NOT NULL)
          END
  </code></pre>