title: Find the next occurance of a day of the week in SQL
body: <p>I'm trying to update a SQL report sproc's WHERE clause to check whether a given date falls on or before the next occurrence of a class. Classes have a StartDate and occur once per week on the same day each week. Given the StartDate, how can I find the next occurrence of that day of the week?</p>
  
  <p>E.G. If the StartDate is 1/18/2012, a Wednesday, and I run the report as of today, 1/26/2012, I need to find 2/1/2012 which is the next Wednesday after 1/26. If the StartDate is 1/19, a Thurs, and I run the report today, the formula should give me Thurs 1/26 which is today.</p>
  
  <p>Here's sort of the idea in SQL:</p>
  
  <pre><code>SELECT *
  FROM tbl_Class cs
  INNER JOIN tbl_Enrollment sce ON cs.pk_ClassID = sce.fk_ClassID
  WHERE ...
  AND sce.StartDate &lt; [Find date of next class after @AsOfDate using cs.StartDate]
  </code></pre>