The MERGE command for SQL Server require that the statement ends with a semicolon (;) and that the semicolon remain with the statement when it is executed by the DB server. DbVisualizer use semicolon as the default statement separator and split multiple statements based on the position of semicolons.

To fix this insert the @delimiter command just before the MERGE command in the SQL Commander to temporarily change the statement separator in DbVisualizer.


The following example show how to re-define the statement delimiter to %%.

@delimiter %%;
MERGE x AS y
<code here>
;
@delimiter ;%%

The last @delimiter ;%% command reverts the statement delimiter from %% to semicolon.


If the MERGE command is the only statement in the SQL editor then you may instead of the above run it with SQL->Execute Buffer.