title: CASE when statement SQL Server
body: <p>I have a stored procedure in the works, however, I'm missing a few pieces of data when I run it. I know the reason why, but I'm having a hard time figure it out... this is my code:</p>
  
  <pre><code>INSERT INTO tempIntake (Pop, PlanID, PopFull, ApptDate, [1stAppt], Followup, Rn, UserID)
  SELECT Pop, PlanID, PopFull, InterviewDate, 1 stAppt, Followup, rn, @UserID
  FROM (
      SELECT *, ROW_NUMBER() OVER (PARTITION BY PlanID ORDER BY AddedDate ASC) AS rn
      FROM VInfo
      WHERE AddedDate IS NOT NULL
  ) t
  WHERE rn = 1 AND interviewdate &gt;= @fromDate AND interviewDate &lt;= @toDate
  </code></pre>
  
  <p>So what I'm trying to do here is this....For some PLANID's I don't have an added date. Because I'm filtering by the AddedDate and in case is null - this data does not come up - even though I need it to be shown. In this case I'd like to make it a dummy date like '1/1/2016' this way, when the actually AddedDate becomes available in the table, it will be used instead of the dummy date. </p>