title: SQL Server MERGE statement with "DUAL" in using clause
body: <p>With Oracle (or DB2, HSQLDB), I can express things like this:</p>
  
  <pre><code>MERGE INTO [target_table]
  USING (SELECT 1 FROM dual)
  ON [target_table.id = 5]
  WHEN MATCHED THEN UPDATE ...
  WHEN NOT MATCHED THEN INSERT ...
  </code></pre>
  
  <p>This just checks if there is already a record with <code>id = 5</code> in <code>target_table</code>. If there is, then the record is update, if there isn't then it is inserted. This is roughly the same as MySQL's more concise</p>
  
  <pre><code>INSERT INTO [target_table] ...
  ON DUPLICATE KEY UPDATE ...
  </code></pre>
  
  <p>How can I do that in SQL Server? According to the documentation, the <code>[table_source]</code> needs to be any of these:</p>
  
  <pre><code>&lt;table_source&gt; ::= 
  {
    table_or_view_name [ [ AS ] table_alias ] [ &lt;tablesample_clause&gt; ] 
          [ WITH ( table_hint [ [ , ]...n ] ) ] 
    | rowset_function [ [ AS ] table_alias ] 
          [ ( bulk_column_alias [ ,...n ] ) ] 
    | user_defined_function [ [ AS ] table_alias ]
    | OPENXML &lt;openxml_clause&gt; 
    | derived_table [ AS ] table_alias [ ( column_alias [ ,...n ] ) ] 
    | &lt;joined_table&gt; 
    | &lt;pivoted_table&gt; 
    | &lt;unpivoted_table&gt;
  }
  </code></pre>
  
  <p><a href="http://msdn.microsoft.com/de-de/library/bb510625.aspx" rel="nofollow">http://msdn.microsoft.com/de-de/library/bb510625.aspx</a></p>
  
  <p>Obviously, SQL Server does not have a <code>DUAL</code> table, but neither is a <code>SELECT</code> statement allowed. What can I put as <code>[table_source]</code> ?</p>
  
  <p>N.B: I found out that I can create a dummy view</p>
  
  <pre><code>CREATE VIEW dummy (one) AS SELECT 1;
  </code></pre>
  
  <p>and supply that as the <code>[table_source]</code>. But I would like to omit DDL statements just to be able to execute this <code>MERGE</code> statement</p>