title: How do I use GETDATE in a WHERE clause using single quotes?
body: <p>How do I use GETDATE() in a WHERE clause using single quotes? I have the following script:</p>
  <pre><code>SELECT DISTINCT 
     pm_requisition.a_requisition
     ,pm_requisition.a_req_description
     ,pm_requisition.rq_position_loc
     ,pm_requisition.rq_status_of_emp
     ,pm_applicant_rec.a_applicant_no
     ,pm_applicant_rec.aq_status_of_appl
     ,pm_applicant_rec.aq_apply_date
  FROM
    pm_requisition
    LEFT OUTER JOIN pm_applicant_rec
      ON pm_requisition.a_requisition = pm_applicant_rec.a_requisition
  WHERE
    pm_requisition.rq_status_of_req NOT IN (N'6', N'7')
    AND pm_applicant_rec.aq_status_of_appl = N'N'
    AND rq_position_loc = '3300'
    AND pm_applicant_rec.aq_apply_date =  CAST(GETDATE()AS datetime2) --('2021-03-30 00:00:00.000')
  </code></pre>
  <p>The dataset does not yield any data using the GETDATE() clause, but if I use today's date (commented out) with single quotes I get the correct dataset. I obviously can't put single quotes around CAST(GETDATE()AS datetime2). Am I missing something simple?</p>