title: SQL Select birthdays in specific date range
body: <p>I have following:</p>
  
  <pre><code>DECLARE @TempTable TABLE 
  (
   [Id] [int],
   [FirstName] [varchar](40) NULL,
   [Birthdate] [date] NULL
  );
  
  insert into @TempTable values (1, 'A', convert(date, '05/25/2017', 101))
  insert into @TempTable values (2, 'B', convert(date, '06/25/2017', 101))
  </code></pre>
  
  <p>What I need is query which will return all Birthdays in range from StartDate to to EndDate.</p>
  
  <p>To be more here is what I expect to get as a result:</p>
  
  <p><strong>Case 1:</strong>
  If date range is set to:</p>
  
  <pre><code>DECLARE @StartDate datetime = '05/01/2017'; 
  DECLARE @EndDate datetime = '07/01/2017';
  </code></pre>
  
  <p>Query should return:</p>
  
  <pre><code>1 A 2017-05-25
  2 B 2017-06-25
  </code></pre>
  
  <p><strong>Case 2:</strong>
  If date range is set to:</p>
  
  <pre><code>DECLARE @StartDate datetime = '05/01/2017'; 
  DECLARE @EndDate datetime = '06/01/2017';
  </code></pre>
  
  <p>Query should return:</p>
  
  <pre><code>1 A 2017-05-25
  </code></pre>
  
  <p><strong>Case 3:</strong>
  If date range is set to:</p>
  
  <pre><code>DECLARE @StartDate datetime = '05/01/2015'; 
  DECLARE @EndDate datetime = '07/01/2017';
  </code></pre>
  
  <p>Query should return:</p>
  
  <pre><code>1 A 2017-05-25
  1 A 2016-05-25
  1 A 2015-05-25
  2 B 2017-06-25
  2 B 2016-06-25
  2 B 2015-06-25
  </code></pre>
  
  <p><strong>Case 4:</strong>
  If date range is set to:</p>
  
  <pre><code>DECLARE @StartDate datetime = '05/01/2015'; 
  DECLARE @EndDate datetime = '06/01/2017';
  </code></pre>
  
  <p>Query should return</p>
  
  <pre><code>1 A 2017-05-25
  1 A 2016-05-25
  1 A 2015-05-25
  2 B 2016-06-25
  2 B 2015-06-25
  </code></pre>