Database MERGE with DB Query Reader
Hi,
I am working with MS SQL Server and try to perform a MERGE operation in the database. The SQL statement roughly looks like:
MERGE [TableTarget] AS tgt
USING [TableSource] AS src
ON (tgt.[A] = src.[A] AND tgt.[B] = src.[B])
WHEN MATCHED THEN
UPDATE SET
tgt.[C] = src.[C]
,tgt.[D] = src.[D]
WHEN NOT MATCHED THEN
INSERT ( [A], [B], [C], [D] )
VALUES ( src.[A] ,src.[B] ,src.[C],src.[D] )
OUTPUT inserted.[D];I am using the “DB Query Reader” node for this in order to retrieve back the data specified by the OUTPUT clause.
When I execute the above statement in a DB Management system (e.g. MS SQL Server Management Studio), it works perfectly. Doing the INSERT or UPDATES, and returning the data requested in OUTPUT.
However, when I execute it in the DB Query Reader node, it doesn’t do any INSERT or UPDATE. (But it still returns data…)
Any ideas how this is possible and why it doesn’t do any insert/update?