title: Skip-over/ignore duplicate rows on insert
body: <p>I have the following tables:</p>
  
  <p><code>DataValue</code></p>
  
  <pre><code>DateStamp    ItemId   Value
  ----------   ------   -----
  2012-05-22   1        6541
  2012-05-22   2        12321
  2012-05-21   3        32
  </code></pre>
  
  <p><code>tmp_holding_DataValue</code></p>
  
  <pre><code>DateStamp    ItemId   Value
  ----------   ------   -----
  2012-05-22   1        6541
  2012-05-22   4        87
  2012-05-21   5        234
  </code></pre>
  
  <p><code>DateStamp</code> and <code>ItemId</code> are the primary key columns.</p>
  
  <p>I'm doing an insert which runs periodically throughout the day (in a stored procedure):</p>
  
  <pre><code>insert into DataValue(DateStamp, ItemId, Value)
  select DateStamp, ItemId, Value from tmp_holding_DataValue;
  </code></pre>
  
  <p>This moves data from the holding table (<code>tmp_holding_DataValue</code>) across into the main data table (<code>DataValue</code>). The holding table is then truncated.</p>
  
  <p>The problem is that as in the example, the holding table could contain items which already exist in the main table. Since the key will not allow duplicate values the procedure will fail.</p>
  
  <p>One option would be to put a where clause on the insert proc, but the main data table has 10 million+ rows, and this could take a long time.</p>
  
  <p>Is there any other way to get the procedure to just skip-over/ignore the duplicates as it tries to insert?</p>