title: SQL Server NULL Values with an Insert statement
body: <p>I have a query that is not doing what I want, I am not sure how to solve this: </p>
  
  <pre><code>DECLARE @RoomMap TABLE
      (ID int IDENTITY(1,1),
      SourceRoom int,--&gt; SourceRoomID
      SourceSiteID int,
      TargetRoom int, --&gt;DemoRoomID
      TargetSiteID int
      )
  
  INSERT INTO @RoomMap
  (SourceRoom, SourceSiteID)
  SELECT tblControls_Rooms.ID, @origSiteID
  FROM tblControls_Rooms
  WHERE SiteID = @OrigSiteID
  
  INSERT INTO @RoomMap
  (TargetRoom, TargetSiteID)
  SELECT tblControls_Rooms.ID, @NewSiteID
  FROM tblControls_Rooms
  WHERE SiteID = @newSiteID
  
  INSERT INTO DemoRoomMap 
  (DemoRoomID, SourceRoomID)
  SELECT TargetRoom, SourceRoom
  FROM @RoomMap
  </code></pre>
  
  <p>THIS is the DemoRoomMap table when I run it:</p>
  
  <pre><code>TargetRoom  SourceRoom
      332 2
      333 3
      334 4
      335 5
      336 6
      337 9
      338 10
  </code></pre>
  
  <p>The result when I run the above query:</p>
  
  <pre><code>TargetRoom  SourceRoom
  NULL    1942
  NULL    1943
  NULL    1944
  NULL    1945
  NULL    1946
  2025    NULL
  2026    NULL
  2027    NULL
  2028    NULL
  </code></pre>
  
  <p>As you can see, there are <code>NULL</code> values which I really do not want to insert! How can I get rid of them?</p>