title: find time slots with sql
body: <p>I have a scenario (SQL 2008) where I need to find the occupied timeframes /non-gaps from the below table. For e.g . I have created this dummy table. </p>
  
  <pre><code>CREATE TABLE Job
  (
  JobID INT NOT NULL,
    WorkerID INT NOT NULL,
    JobStart DATETIME NOT NULL,
    JobEnd DATETIME NOT NULL
  );
  
  INSERT INTO Job (JobID, WorkerID, JobStart, JobEnd)
      VALUES (1, 25, '2012-11-17 16:00', '2012-11-17 17:00'),
          (2, 25, '2012-11-17 16:00', '2012-11-17 16:50'),
          (3, 25, '2012-11-19 18:00', '2012-11-19 18:30'),
          (4, 25, '2012-11-19 17:30', '2012-11-19 18:10'),
          (5, 26, '2012-11-18 16:00', '2012-11-18 17:10'),
          (6, 26, '2012-11-18 16:00', '2012-11-19 16:50');
  </code></pre>
  
  <p>so for this , the qry shd return data like this:</p>
  
  <pre><code>WorkerID | StartDate | EndDate
  25      2012-11-17 16:00   2012-11-17 17:00
  25      2012-11-17 17:30   2012-11-17 18:30
  26      2012-11-18 16:00    2012-11-18 17:10
  </code></pre>
  
  <p>I am able to get the result but I am using while loop and its a pretty iterative method. Any chance , I can avoid using while to get the result</p>