title: T-SQL code to add 7 days to a date
body: <p>The below statement adds 7 days to the shipment date if we miss the ship date. For example, something that was supposed to ship on <code>07/24/2014</code> did not get shipped for some reason. The following query adds 7 days (resulting in <code>07/31/2014</code>) to the ship date.</p>
  
  <p>The only problem is the 'Test Ship' column adds 7 days to the shipment date only on Sundays if we miss the shipment date. What I mean is that for the jobs that had a scheduled ship date of <code>07/24/2014</code>, and we missed shipping the jobs on that day, the below column 'Test Ship' updates the next scheduled ship day to <code>07/31/2014</code> only on SUNDAY.</p>
  
  <p>For example, say job <code>J012345</code> did not get shipped on <code>07/24/2014</code>. Then the 'Test Ship' column will update the date to tomorrow i.e <code>07/27/2014</code> (Sunday) instead of updating it on FRIDAY <code>07/25/2014</code>. Am I missing anything here? How can I get 'Test Ship' to update the date on FRIDAY instead of SUNDAY?</p>
  
  <pre><code>'Test Ship' =
  CASE
   WHEN j.JobStatus &lt;&gt; 'S'
   AND CAST(x.ExpectedDate AS date)
      &lt; DATEADD(wk, DATEDIFF(wk, 3, CAST(GETDATE() AS date)), 3)
   THEN DATEADD(DAY, 4, CAST(DATEADD(week, DATEDIFF(week, 0, GETDATE()), -1) AS date)) 
  
   WHEN j.JobStatus ='S'
   THEN CAST(j.LastShippedDate AS date)
  
   ELSE CAST(x.ExpectedDate AS date)
  END
  </code></pre>